[cmake-developers] [CMake 0014294]: Command-line options overwritten by re-run
Mantis Bug Tracker
mantis at public.kitware.com
Mon Jul 15 20:17:23 EDT 2013
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=14294
======================================================================
Reported By: Greg Coombe
Assigned To:
======================================================================
Project: CMake
Issue ID: 14294
Category: CMake
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-07-15 20:17 EDT
Last Modified: 2013-07-15 20:17 EDT
======================================================================
Summary: Command-line options overwritten by re-run
Description:
If I specify a command-line option using the "option()" function and provide it
on the command line along with CMAKE_<lang>_COMPILER option (specified without
full path), it is overwritten.
Steps to Reproduce:
1. Make a small CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.11)
option(RERUN_TEST "Re-run me!" OFF)
message(STATUS "Re-run test variable is " ${RERUN_TEST})
2. Run twice with both the option specified, as well as the compiler:
$ cmake -D RERUN_TEST=ON -D CMAKE_CXX_COMPILER=g++ CMakeLists.txt
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Re-run test variable is ON
-- Configuring done
-- Generating done
$ cmake -D RERUN_TEST=ON -D CMAKE_CXX_COMPILER=g++ CMakeLists.txt
-- Re-run test variable is ON
-- 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++
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Re-run test variable is OFF
-- Configuring done
-- Generating done
So now we've built the project without the command-line option.
3. Interestingly, note that using the full path of the compiler doesn't have the
same behavior:
$ cmake -D RERUN_TEST=ON -D CMAKE_CXX_COMPILER=/usr/bin/g++ CMakeLists.txt
-- Re-run test variable is ON
-- Configuring done
-- Generating done
Additional Information:
Speculation:
It appears that CMake is writing the CMAKE_<lang>_COMPILER value to the cache
before expanding it, then interpreting the different value as requiring a
re-run. This re-run ignores the command-line options (maybe because the cache is
nuked: http://public.kitware.com/Bug/view.php?id=13756).
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-07-15 20:17 Greg Coombe New Issue
2013-07-15 20:17 Greg Coombe File Added: CMakeLists.txt
======================================================================
More information about the cmake-developers
mailing list