[CMake] build type specific compiler flags
Filipe Sousa
natros at gmail.com
Tue Apr 3 13:34:38 EDT 2007
Jesper Eskilson wrote:
> Hi!
>
> I would like to be able to specify compiler flags (or -D options,
> specifically) bound to a specific build type, i.e. Debug, Release,
> etc. How can I do this? There is a target property
> LINK_FLAGS_<CONFIG>, but there is no COMPILE_FLAGS_<CONFIG>.
>
http://www.cmake.org/Wiki/CMake_Useful_Variables :
"""
CMAKE_BUILD_TYPE
Choose the type of build. CMake has default flags for these:
* None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used)
* Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG)
* Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
* RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
* MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
Example: SET(CMAKE_BUILD_TYPE Debug)
You can create your own build type like this:
SET(CMAKE_BUILD_TYPE distribution)
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
SET(CMAKE_C_FLAGS_DISTRIBUTION "-O3")
Note that CMAKE_BUILD_TYPE is not initialized with a readable value at configuration time.
This is because the user is free to select a build type at build time.
"""
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20070403/1d7577af/signature.pgp
More information about the CMake
mailing list