RFE: Report changes to cached values
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Original description:
Add a variable to CMake such that it will report when a cached variable's value is different from the default being set. For example:
set(var dflt CACHE STRING "description")
could output:
path/to/CMakeLists.txt:42: var 'dflt' -> 'cachedvalue'
and could also, at the end of configure, print out a command line (or initial cache file) to be used to duplicate the build on another machine. I was thinking of CMAKE_REPORT_DELTA
as the control variable.
Came up from a gn thread.
@brad.king:
Comment fromNote that in Modules/CMakeGenericSystem.cmake
we do:
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1)
endif()
# ...
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "...")
# ...
so that applications can know when they can force a different default for CMAKE_INSTALL_PREFIX
without overriding a user setting.
This could be generalized for use with all cache entries. It would be helpful for projects that want to override the default CMAKE_C_FLAGS_DEBUG
, for example, without needing to use CMAKE_USER_MAKE_RULES_OVERRIDE
and a separate file.
See also discussion in #14546 (closed).