[cmake-developers] RFC/Review Request: Topic GNUInstallDirs_debian-multiarch-fix

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Mon Jan 13 10:23:15 EST 2014


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



More information about the cmake-developers mailing list