[cmake-developers] [Review Request] Topic CMakePackageConfigHelpers_build_tree

Brad King brad.king at kitware.com
Wed Jul 30 13:23:18 EDT 2014


On 07/30/2014 11:57 AM, Daniele E. Domenichelli wrote:
> I never used multiple project calls, so I don't know how it works, would
> PROJECT_BINARY_DIR be an appropriate replacement for CMAKE_BINARY_DIR?

No, because we don't know if the most-nested project() call is the
right one either.

> Should INSTALL_DESTINATION always be relative to CMAKE_BINARY_DIR or
> should it be relative to BUILD_TREE?

The purpose of INSTALL_DESTINATION is to help the generated file
compute the installation prefix relative to itself.  Therefore it
needs to be treated relative to the same place all other paths
will be treated relative to.  This is BUILD_TREE when the option
is specified.

> Maybe BUILD_TREE is no longer an appropriate name if you can set it to
> any folder, maybe RELATIVE_DIR or something similar would be more
> appropriate?

The purpose of the BUILD_TREE option is now to specify a different
value to be used anywhere ${CMAKE_INSTALL_PREFIX} is now.  I think
the name "INSTALL_PREFIX" may be best.  This approach generalizes
the feature even to the case of preparing a package config file
for a prefix besides the current value of CMAKE_INSTALL_PREFIX
even when it really will be installed.

Basically in the implementation you can replace any occurence of
${CMAKE_INSTALL_PREFIX} with a ${installPrefix} local that is set
to either CMAKE_INSTALL_PREFIX or the value of the INSTALL_PREFIX
option.

-Brad




More information about the cmake-developers mailing list