Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake ignoring CMAKE_BUILD_TYPE=Debug

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

like image 777
zenna Avatar asked Jun 14 '12 14:06

zenna


4 Answers

You have a typo. Your code says CMAKE_CSS_FLAGS_RELEASE. Notice CSS, it should be CXX.

like image 97
doug65536 Avatar answered Oct 17 '22 03:10

doug65536


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
like image 36
zenna Avatar answered Oct 17 '22 04:10

zenna


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.

like image 2
Cyrs Avatar answered Oct 17 '22 04:10

Cyrs


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.

like image 1
exbluesbreaker Avatar answered Oct 17 '22 03:10

exbluesbreaker