[CMake] Custom Build Type GCC on Linux

Clemens Arth clemens.arth at gmx.at
Mon Mar 23 14:09:40 EDT 2009


Clemens Arth wrote:
> Hi,
>
> I got a rather simple question. To add some special optimization flags 
> to a custom build for one of our projects, I followed the guide to add 
> a custom build type to my project using the example found here:
>
> http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_extend_the_build_modes_with_a_custom_made_one_.3F 
>
>
> I simply copy-pasted the code found there into a separate file and did 
> the following:
>
> project(Dummy)
> include(maintainermode.cmake)
> add_library(dummylib dummy.cpp)
>
> To build it I run:
> >>cmake -DCMAKE_BUILD_TYPE=Maintainer ..
> and
> >>make
>
> Although everything seems to be correct, I can't get the stuff 
> compiled with the new mode - it definitely adds the configuration, but 
> I simply cannot build it like Release or Debug. It always sticks back 
> to Debug.
>
> Did I miss something here?
Ok, to answer myself I obviously missed something. I think the solution 
to this is to change

# Update the documentation string of CMAKE_BUILD_TYPE for GUIs
SET( CMAKE_BUILD_TYPE "" CACHE STRING
"Choose the type of build, options are: None Debug Release 
RelWithDebInfo MinSizeRel Maintainer."
FORCE )

to

# Update the documentation string of CMAKE_BUILD_TYPE for GUIs
SET( CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING
"Choose the type of build, options are: None Debug Release 
RelWithDebInfo MinSizeRel Maintainer."
FORCE )

However, is this known to break something else?

Clemens






More information about the CMake mailing list