I'm just trying to build a cmake project in debug-mode to enable asserts. I tried the following versions:
cmake -D CMAKE_BUILD_TYPE:STRING=Debug -L ../../
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -L ../../
cmake -DCMAKE_BUILD_TYPE=Debug -L ../../
Unfortunately none of theese has the desired effect - that CMAKE_BUILD_TYPE
is set to Debug
(and therefore the NDEBUG
-flag is not passed to gcc).
Additionally I added variable_watch(CMAKE_BUILD_TYPE)
to my main CMakeLists.txt
to check whether the value get's overridden somewhere. But the first output is a READ_ACCESS
in my main
Additionally I added variable_watch(CMAKE_BUILD_TYPE)
to my main CMakeLists.txt
and the value there already is Release
.
Does someone have an idea why cmake ignores the configuration?
I'm using cmake version 2.8.7.
Thank's in advance for any help!
Ok,
fgrep -R "CMAKE_BUILD_TYPE"
finally found the problem for me. In someCMakeLists.txt
-file I found something like that:That overrides every user defined parameters (because of the
FORCE
).What works for me is that:
Thank's for your hints!
I assume that there is something wrong with your config..
I wrote a complete, simple example here: https://dl.dropboxusercontent.com/u/68798379/cmake-build-type.tar.bz2
When you execute cmake with
It gives the following output:
It shows that CMAKE_BUILD_TYPE is being set from the command line and it being recognized in the CMakeLists.txt config.
What happens when you run it on your system using your version of CMake?