[cmake-developers] Bug: CMakePackageConfigHelpers can't cope with empty install prefix

Brad King brad.king at kitware.com
Mon Aug 10 10:38:10 EDT 2015


On 08/10/2015 10:21 AM, rleigh at codelibre.net wrote:
> I often configure projects with an empty install prefix and install with
> DESTDIR set.  This works for most projects and they are relocatable. 

So long as projects don't contain internal references that hard-code
the prefix then relocatable packages can be built with any prefix.
Just package the binary tarball with paths relative to the staging
prefix.

> CMake Error at cmake/CMakePackageConfigHelpers.cmake:254 (file):
>   file RELATIVE_PATH must be passed a full path to the file:
> Call Stack (most recent call first):
>   CMakeLists.txt:157 (configure_package_config_file)

The line in question is:

  file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )

IIUC its purpose is to compute a relative path from the location where
the package configuration file is to be installed (absInstallDir) up
to the installation prefix (installPrefix).  A special case here will
be needed to compute this for an empty install prefix.

-Brad



More information about the cmake-developers mailing list