[CMake] compile options

Bill Hoffman bill.hoffman at kitware.com
Fri Jun 20 09:26:43 EDT 2008


This will not work:

   IF (${CMAKE_CFG_INTDIR} MATCHES "Debug")

That is not really known until build time.  When CMake is run, it 
creates a visual studio project that can build Debug, Release, or some 
other configuration.  So, at cmake time you don't know which ones will 
be built.

COMPILE_FLAGS do not seem to have a per configuration option yet for 
target properties.   LINK_FLAGS do.  So, this works:

LINK_FLAGS_DEBUG
LINK_FLAGS_RELEASE,

But COMPILE_FLAGS_DEBUG and COMPILE_FLAGS_RELEASE do not work.  Feel 
free to create a feature request in the bug tracker.

As a work around, you can set the global variables CMAKE_CXX_FLAGS_DEBUG 
CMAKE_CXX_FLAGS_RELEASE.

If you do not need to set specific flags per target that would be the 
best way to go.

-Bill


More information about the CMake mailing list