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

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Mon Jan 13 09:47:39 EST 2014


On 13/01/14 15:34, Brad King wrote:
> This hunk:
> 
> -if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
> 
> removes the guard that avoids doing all the default-computing
> logic when there is already a value.  In this hunk:
> 
> +set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})" FORCE)
> 
> one should not FORCE the cache entry.  Otherwise there is no way
> for the local users to change the setting for their build trees.
> 
> Both of the above are incorrect and seem unrelated to the proposed
> change.


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.

But I also just realized that the variable is "CACHE PATH" for some
reason I thought it was "CACHE INTERNAL", that means that the user can
change it, and therefore the force is not a good idea.

How do you suggest to handle this?



> In this hunk:
> 
> +    if (${CMAKE_INSTALL_PREFIX} MATCHES "^/usr/?$")
> 
> the left side should be quoted or just the plain variable name
> to ensure it works when the prefix value is an empty string.

Fixed in the topic.



Thanks,
 Daniele




More information about the cmake-developers mailing list