If my compiler changes between the last invocation of cmake and this
one, then cmake will restart itself; this part works fine.  The problem
is that if I've invoked cmake with some command line overrides, they are
lost when I restart.  For example if I have in my makefile:

  set(BUILDNUM "0" CACHE STRING "Build Number")
  message(STATUS "Build number = ${BUILDNUM}")

by default this is 0, so when developers build locally the build number
is 0.  When cmake is invoked through our CI build system, it is run like
this:

  cmake -DBUILDNUM=125 .

or whatever the current build number is for that build.

However, if the compiler has changed and we need to restart the build,
this breaks:

  -- Build number = 125
  -- 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= /new/bin/x86_64-rh55-linux-gnu-gcc
  CMAKE_CXX_COMPILER= /new/bin/x86_64-rh55-linux-gnu-g++

  -- Build number = 0
  -- Configuring done
  -- Generating done
  -- Build
files have been written to: /home/psmith/src/cmake/restart

Note that when cmake re-runs itself the command line setting for BUILDNUM has 
been lost and it reverts to the default value.

To me this is a bug... thoughts?

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to