View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014017 | CMake | CMake | public | 2013-03-15 07:56 | 2016-06-10 14:31 | ||||
Reporter | Sylwester Arabas | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.11 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014017: Option -DCMAKE_<LANG>_COMPILER=... deletes cached settings even if given original value | ||||||||
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 | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0032638) Brad King (manager) 2013-03-15 08:22 edited on: 2013-03-16 19:44 |
Using cmake . -DCMAKE_CXX_COMPILER=g++-4.7 -DCMAKE_BUILD_TYPE=Release works correctly when run with a fresh tree. |
(0032650) Brad King (manager) 2013-03-16 19:50 |
This is an accidental side effect of the implementation of the "change compiler" feature requested by 0006102. The feature is meant for use when first configuring a source tree with "ccmake" so the compiler can be changed interactively even after the initial configuration. Whenever the value of a CMAKE_<LANG>_COMPILER cache entry changes CMake wipes out the entire CMakeCache.txt so that all try_compile tests and other checks that depend on the compiler choice will be re-run. As a side effect it wipes out all other settings too but in the "ccmake" initial configuration case that is not a problem. This is triggering improperly in your case. On the first run CMake converts the "-DCMAKE_CXX_COMPILER=g++-4.7" value to a full path, e.g. /usr/bin/g++-4.7. When you run CMake on an existing tree with the same option then the name "g++-4.7" is not the same as the full path so CMake thinks you're changing the compiler (which technically you could be if the PATH is different). Then it wipes out the entire cache including the CMAKE_BUILD_TYPE value it just recorded. It is not completely silent as you originally reported because the output says it is deleting the cache, but it is not a very clear explanation either. |
(0042249) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-03-15 07:56 | Sylwester Arabas | New Issue | |
2013-03-15 08:22 | Brad King | Note Added: 0032638 | |
2013-03-15 08:22 | Brad King | Status | new => resolved |
2013-03-15 08:22 | Brad King | Resolution | open => won't fix |
2013-03-16 19:41 | Brad King | Status | resolved => backlog |
2013-03-16 19:41 | Brad King | Resolution | won't fix => open |
2013-03-16 19:41 | Brad King | Product Version | CMake 2.8.9 => CMake 2.8.11 |
2013-03-16 19:41 | Brad King | Summary | -DCMAKE_BUILD_TYPE silently ignored if specified together with -DCMAKE_CXX_COMPILER => Option -DCMAKE_<LANG>_COMPILER=... deletes cached settings even if given original value |
2013-03-16 19:44 | Brad King | Note Edited: 0032638 | |
2013-03-16 19:50 | Brad King | Note Added: 0032650 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042249 | |
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |