mirror of
https://github.com/reactos/CMake.git
synced 2024-11-30 23:10:26 +00:00
configure_package_config_file: force absolute paths for usr-move
The configure_package_config()_file() macro will now use absolute paths for the PATH_VARS if the Config.cmake file will be installed into /lib(64) or /usr/lib(64), since due to the usr-move filesystem changes Config.cmake files installed there may be found via two paths (once per symlink via /lib(64) and once via /usr/lib ), and in this case relative paths break. Alex
This commit is contained in:
parent
21fc6c46df
commit
d4774140b7
@ -173,18 +173,34 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
|
|||||||
else()
|
else()
|
||||||
set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
|
set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
|
||||||
endif()
|
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}" )
|
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
|
||||||
|
|
||||||
foreach(var ${CCF_PATH_VARS})
|
foreach(var ${CCF_PATH_VARS})
|
||||||
if(NOT DEFINED ${var})
|
if(NOT DEFINED ${var})
|
||||||
message(FATAL_ERROR "Variable ${var} does not exist")
|
message(FATAL_ERROR "Variable ${var} does not exist")
|
||||||
else()
|
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}}")
|
if(IS_ABSOLUTE "${${var}}")
|
||||||
string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
|
string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
|
||||||
PACKAGE_${var} "${${var}}")
|
PACKAGE_${var} "${${var}}")
|
||||||
else()
|
else()
|
||||||
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
|
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user