On 13/01/14 15:57, Brad King wrote: > On 01/13/2014 09:47 AM, Daniele E. Domenichelli wrote: >> The problem comes when you change the CMAKE_INSTALL_PREFIX: >> >> When you run cmake (with no -DCMAKE_INSTALL_PREFIX=... argument), >> CMAKE_INSTALL_PREFIX is set to /usr/local, and the CMAKE_INSTALL_LIBDIR >> is set to lib. >> >> If later you want to change it to CMAKE_INSTALL_PREFIX to /usr, without >> the removing the if(), the code is not called, and without the "FORCE", >> the cached value is not updated. > > Store an empty string in the cache but with help text that says > what the default will be. When the cached value is set to non-empty > then use it because we know the user must have set it to something. > Otherwise compute the default and set it as a normal variable.
But if the file is not included in the top directory, then the variable will not be set for other sub-directories, and I think that this might be considered a change of behaviour, and might break some builds. Can I store CMAKE_INSTALL_PREFIX in an internal cached variable, check if it was changed since last run (i.e. CMAKE_INSTALL_PREFIX_OLD != CMAKE_INSTALL_PREFIX), check if the value is the default one, and eventually force-set it to the new default? Daniele -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers