I am trying to include debug/release dependent compiler flags, such as:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x -Wall -DUSE_BOOST")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O3")
I create my build folder with a command such as:
cmake -DCMAKE_BUILD_TYPE=Release -D UseFortran=True -D CMAKE_CXX_COMPILER=g++-4.6 ~/repos/cliques/cliques
However it seems with CMAKE version 2.8.7, CMAKE_BUILD_TYPE is being ignored. It seems to work perfectly with version 2.8.4 (on a different machine), so has this method been deprecated or is there some other problem here?
Zenna
You have a typo. Your code says CMAKE_CSS_FLAGS_RELEASE
. Notice CSS
, it should be CXX
.
The problem was that there must be a space between the -D
and the variable. That is, it should be:
cmake -D CMAKE_BUILD_TYPE=Release -D UseFortran=True -D CMAKE_CXX_COMPILER=g++-4.6 ~/repos/cliques/cliques
I think they made a Typo In CMAKE_BUILD_TYPE in the previous version. We had this porblem and here a line that works.
cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../src
You may check that every things went fine using:
cmake -L ../src
Using this command may give you the right way to name the variable CMAKE_BUILD_TYPE.
Good luck.
Why are you not using -DCMAKE_BUILD_TYPE=Debug
, when creating build folder?
Cmake build Release type project or Debug type project, not both together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With