[cmake-developers] [CMake 0014546]: CACHE variables persist through reruns
Mantis Bug Tracker
mantis at public.kitware.com
Wed Nov 6 00:33:51 EST 2013
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=14546
======================================================================
Reported By: Alp Toker
Assigned To:
======================================================================
Project: CMake
Issue ID: 14546
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-11-06 00:33 EST
Last Modified: 2013-11-06 00:33 EST
======================================================================
Summary: CACHE variables persist through reruns
Description:
Hello,
We're using CMake in the LLVM/clang Open Source project and noticed that CACHE
variables are getting persisted after regenerating makefiles (reference:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-October/032957.html)
This means that upstream SVN changes to any CACHE variable (such as the binary
version number, default bug report URL etc.) don't take effect on developers
systems.
The most visible result of this is that, when the project makes a new release,
existing builds continue to use the old version number taken from the cache.
This happens with all other CACHE variables too.
Steps to Reproduce:
Configure a project that has the following CACHE variable in CMakeLists.txt:
set(BUG_REPORT_URL "http://llvm.org/bugstypo/" CACHE STRING
"Default URL where bug reports are to be submitted.")
Then build the project.
Then modify the URL in CMakeLists.txt, changing it from
"http://llvm.org/bugstypo/" to "http://llvm.org/bugs/"
Then rebuild the project.
Problem: BUG_REPORT_URL is still "http://llvm.org/bugstypo/"
Expected result: BUG_REPORT_URL should have been updated to
"http://llvm.org/bugs/"
The issue has been observed with the Makefile and Ninja generator, and
presumably all other generators are affected.
Additional Information:
I've investigated and this seems to be a bug in
cmMakefile::AddCacheDefinition(), which is caching the default value for the
variable even when the user hasn't overridden it on the commandline or in the
CMake GUI.
I'm working on a patch that teaches CMake to differentiate between the
declaration, definition and default value of a CACHE variable.
An additional benefit of this approach is that it adds a "Reset to default"
option for CACHE variables in the CMake GUI.
There should otherwise be no change in behaviour other than resolving the
problem as described. Specifically, if the user defines the variable explicitly,
the user definition will continue persist same as before.
I'll upload the patch shortly. Please let me know if you're already aware of /
working on an alternative solution to this issue.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-11-06 00:33 Alp Toker New Issue
======================================================================
More information about the cmake-developers
mailing list