MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015893 | CMake | CMake | public | 2015-12-22 20:00 | 2016-06-10 14:31 |
Reporter | Paul Smith | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | Intel | OS | GNU/Linux | OS Version | Ubuntu 15.10 |
Product Version | CMake 3.4.1 | ||||
Target Version | Fixed in Version | ||||
Summary | 0015893: If cmake needs to restart due to changed compiler, it loses all command line variable assignments | ||||
Description | If I invoke "cmake -DFOO=bar ." and cmake discovers that the compiler is changed and needs to re-invoke itself it does so automatically but in the process it loses all the -D options from the command line, so they're not set in the restart making it inaccurate. | ||||
Steps To Reproduce | Given this CMakeLists.txt: cmake_minimum_required(VERSION 3.4.1) project(Restart NONE) set(BUILDNUM "0" CACHE STRING "Build Number") if(EXISTS "my/gcc") set(CMAKE_C_COMPILER "${CMAKE_CURRENT_BINARY_DIR}/my/gcc" CACHE FILEPATH "C compiler" FORCE) else() set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE FILEPATH "C compiler" FORCE) endif() message(STATUS "Build Number: ${BUILDNUM}") enable_language(C) Now run it once without the local "my" link, overridding BUILDNUM: $ cmake -DBUILDNUM=99 . -- Build Number: 99 -- The C compiler identification is GNU 5.2.1 -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/psmith/src/cmake/restart Now create the symlink and run it again: it will change the compiler and restart: $ ln -s /usr/bin my $ cmake -DBUILDNUM=99 . -- Build Number: 99 -- 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_C_COMPILER= /home/psmith/src/cmake/restart/my/gcc -- Build Number: 0 -- The C compiler identification is GNU 5.2.1 -- Check for working C compiler: /home/psmith/src/cmake/restart/my/gcc -- Check for working C compiler: /home/psmith/src/cmake/restart/my/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/psmith/src/cmake/restart Note how initially the value of BUILDNUM is 99, but then cmake decides to re-execute itself and afterwards that override is lost and we get the default value of "0". | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-12-22 20:00 | Paul Smith | New Issue | |||
2016-04-21 10:21 | Antonio | Note Added: 0040905 | |||
2016-04-21 14:26 | Paul Smith | Note Added: 0040916 | |||
2016-04-21 14:34 | Brad King | Note Added: 0040917 | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042904 | |||
2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|