diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2024-04-08 14:49:39 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2024-04-11 01:27:32 +0200 |
commit | 2d19f09b577f72290328d90ba85145362676ea92 (patch) | |
tree | d344112cf4c2fcb3897809b26aff21281f03b7b4 /cmake | |
parent | 6760bae2fa7a758ac8eb70c0009c80a715ea1c54 (diff) |
Avoid using PACKAGE_PREFIX_PATH for configure-time executables
PACKAGE_PREFIX_PATH is not defined in cmake versions 3.29.x.
We should avoid referring the internal CMake variables.
Use the calculated reverse relative path to the prefix path
instead.
Fixes: QTBUG-124186
Pick-to: 6.5 6.6 6.7
Change-Id: Iefae132e61a3f8e8f5525c0abd6a2d41631c2fb0
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index 8cc09fe83d..e669047ff1 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -830,17 +830,30 @@ endif() get_target_property(configure_time_target_install_location ${target} IMPORTED_LOCATION) else() + if(IS_ABSOLUTE "${arg_CONFIG_INSTALL_DIR}") + file(RELATIVE_PATH reverse_relative_prefix_path + "${arg_CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}") + else() + file(RELATIVE_PATH reverse_relative_prefix_path + "${CMAKE_INSTALL_PREFIX}/${arg_CONFIG_INSTALL_DIR}" + "${CMAKE_INSTALL_PREFIX}") + endif() + get_target_property(configure_time_target_build_location ${target} _qt_internal_configure_time_target_build_location) - - set(configure_time_target_build_location - "$\{PACKAGE_PREFIX_DIR}/${configure_time_target_build_location}") + string(TOUPPER "${QT_CMAKE_EXPORT_NAMESPACE}_INSTALL_PREFIX" install_prefix_var) + string(JOIN "" configure_time_target_build_location + "$\{CMAKE_CURRENT_LIST_DIR}/" + "${reverse_relative_prefix_path}" + "${configure_time_target_build_location}") get_target_property(configure_time_target_install_location ${target} _qt_internal_configure_time_target_install_location) - set(configure_time_target_install_location - "$\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}") + string(JOIN "" configure_time_target_install_location + "$\{CMAKE_CURRENT_LIST_DIR}/" + "${reverse_relative_prefix_path}" + "${configure_time_target_install_location}") endif() if(configure_time_target_install_location) string(APPEND content " |