[cmake-developers] Target's IMPORTED_LOCATION_* when CMAKE_INSTALL_PREFIX or CPACK_PACKAGING_INSTALL_PREFIX is "/"

Brad King brad.king at kitware.com
Tue Sep 6 15:24:51 EDT 2016


On 09/06/2016 03:00 PM, Ben Keller wrote:
> The workaround we are using for this currently is to compile a
> modified version of cmake that appends the following cmake code below
> the get_filename_component stanza in <PROJECTS>Targets.cmake:
> 
> if("${_IMPORT_PREFIX}" STREQUAL "/")
>   set(_IMPORT_PREFIX "")
> endif()

I would consider that a fix rather than a workaround.  We don't know
the prefix that will be computed since this block is meant to make
the package relocatable.  We do know that references to the prefix
are always followed by "/" so it is safe to leave it as an empty
string.

Please post the patch.

Thanks,
-Brad



More information about the cmake-developers mailing list