Cmake ignores CMAKE_BUILD_TYPE = Debugging

I am trying to enable debug / release dependent compiler flags, for example:

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 a folder for the assembly using the command, for example:

 cmake -DCMAKE_BUILD_TYPE=Release -D UseFortran=True -D CMAKE_CXX_COMPILER=g++-4.6 ~/repos/cliques/cliques 

However, CMAKE version 2.8.7 seems to be ignored. It seems to work fine with version 2.8.4 (on another machine), is this method deprecated or is there some other problem?

Zenna

+7
source share
4 answers

You have a typo. Your code says CMAKE_CSS_FLAGS_RELEASE . Pay attention to CSS , this should be CXX .

+5
source

The problem was that there should be a space between -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 
+4
source

I think they did Typo In CMAKE_BUILD_TYPE in the previous version. We had this emblem, and the line works here.

 cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../src 

You can verify that everything is going well using:

 cmake -L ../src 

Using this command may give you the correct way to name the variable CMAKE_BUILD_TYPE.

Good luck.

+2
source

Why don't you use -DCMAKE_BUILD_TYPE=Debug when creating the build folder? Cmake build A release type project or a debug type project, not both together.

+1
source

All Articles