summaryrefslogtreecommitdiffstats
path: root/Modules/CMakePackageConfigHelpers.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CMakePackageConfigHelpers.cmake')
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index a92ce7c..13617ce 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -173,18 +173,34 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
else()
set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
endif()
+
+ # with the /usr-move, /lib(64) is a symlink to /usr/lib on Fedora, ArchLinux, Mageira and others.
+ # If we are installed to such a location, force using absolute paths.
+ set(forceAbsolutePaths FALSE)
+ if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
+ set(forceAbsolutePaths TRUE)
+ endif()
+
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
foreach(var ${CCF_PATH_VARS})
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} does not exist")
else()
+ if(forceAbsolutePaths)
+ if(IS_ABSOLUTE "${${var}}")
+ set(PACKAGE_${var} "${${var}}")
+ else()
+ set(PACKAGE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
+ endif()
+ else()
if(IS_ABSOLUTE "${${var}}")
string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
endif()
+ endif()
endif()
endforeach()