summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2024-04-08 14:49:39 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-11 02:24:45 +0000
commitcd93a8dc8e4c401421b4a581be217acd4e626d7d (patch)
tree01e981ba41ce964e61c58b3e8d404b3583d157c8 /cmake
parent37d8317638cd116f068f5c10005b37ba4d264351 (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.6 6.5 Change-Id: Iefae132e61a3f8e8f5525c0abd6a2d41631c2fb0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 2d19f09b577f72290328d90ba85145362676ea92) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTargetHelpers.cmake23
1 files changed, 18 insertions, 5 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index 631df93dc2..2d4f2181e2 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -827,17 +827,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 "