[CMake] How too set properties on all executables
Hanna Symanska
hsymanska at gmail.com
Thu Feb 24 15:34:44 EST 2011
Hey,
I have a fairly large project with multiple executables, about 90 to
be exact and I would like to set the subsystem based on the
LINK_FLAGS_* property.
Is there a way for me to globally set this up in a top level
CMakeLists.txt file so that i do not have to place the below code in
every single project.
add_executable(project_n ....)
IF (WIN32)
SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_RELEASE
"/INCREMENTAL:NO /NODEFAULTLIB:LIBCMT.lib /SUBSYSTEM:WINDOWS" )
SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_RELWITHDEBINFO
"/NODEFAULTLIB:LIBCMT.lib /SUBSYSTEM:WINDOWS" )
SET_TARGET_PROPERTIES(project_n PROPERTIES LINK_FLAGS_DEBUG
"/NODEFAULTLIB:LIBCMTD.lib /SUBSYSTEM:CONSOLE" )
ENDIF (WIN32)
As it stands right now I have a top level CMakeLists.txt file with
several other CMakeLists.txt files in subsequent directories.
I have 1 CMakeLists.txt per project executable. I am trying to avoid
putting the above code in EVERY CMakeLists.txt file, when the only
thing I am changing is the target to reflect the the project that I am
setting the properties on.
I am using CMake 2.8.4 to generate visual studio 2008 project files to
be compiled 64-bit.
I do not want to use set_executable(project_n WIN32...) because I want
the subsystem to be console for projects that are being compiled as
debug.
- Hanna
More information about the CMake
mailing list