[cmake-developers] [CMake 0014017]: -DCMAKE_BUILD_TYPE silently ignored if specified together with -DCMAKE_CXX_COMPILER

Mantis Bug Tracker mantis at public.kitware.com
Fri Mar 15 07:56:18 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14017 
====================================================================== 
Reported By:                Sylwester Arabas
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14017
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-03-15 07:56 EDT
Last Modified:              2013-03-15 07:56 EDT
====================================================================== 
Summary:                    -DCMAKE_BUILD_TYPE silently ignored if specified
together with -DCMAKE_CXX_COMPILER
Description: 
Hello,

The commands listed below exemplify that one may get different behaviour of
CMake when running:

cmake . -DCMAKE_CXX_COMPILER=g++-4.7 -DCMAKE_BUILD_TYPE=Release

and

cmake . -DCMAKE_CXX_COMPILER=g++-4.7; 
cmake . -DCMAKE_BUILD_TYPE=Release

HTH,
Sylwester

Steps to Reproduce: 
$ cat CMakeLists.txt 
project(test CXX)
set(CMAKE_CXX_FLAGS_RELEASE "-Ofaast")
add_executable(test test.cpp)


$ cat test.cpp 
int main() {}


$ cmake . -DCMAKE_CXX_COMPILER=g++-4.7 -DCMAKE_BUILD_TYPE=Release
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= g++-4.7

-- The CXX compiler identification is GNU 4.7.2
-- Check for working CXX compiler: /usr/bin/g++-4.7
-- Check for working CXX compiler: /usr/bin/g++-4.7 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/slayoo/Temp/cmake-test


$ make
Scanning dependencies of target test
[100%] Building CXX object CMakeFiles/test.dir/test.cpp.o
Linking CXX executable test
[100%] Built target test


$ cmake . -DCMAKE_CXX_COMPILER=g++-4.7; cmake . -DCMAKE_BUILD_TYPE=Release
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= g++-4.7

-- The CXX compiler identification is GNU 4.7.2
-- Check for working CXX compiler: /usr/bin/g++-4.7
-- Check for working CXX compiler: /usr/bin/g++-4.7 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/slayoo/Temp/cmake-test
-- Configuring done
-- Generating done
-- Build files have been written to: /home/slayoo/Temp/cmake-test


$ make
Scanning dependencies of target test
[100%] Building CXX object CMakeFiles/test.dir/test.cpp.o
cc1plus: error: argument to ‘-O’ should be a non-negative integer
make[2]: *** [CMakeFiles/test.dir/test.cpp.o] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-03-15 07:56 Sylwester ArabasNew Issue                                    
======================================================================




More information about the cmake-developers mailing list