summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2022-07-11 15:11:35 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2022-07-13 12:52:00 +0200
commit8b5cce6911a0854cd794c23e53908e8ddcc3843f (patch)
tree761cf726f6e06ef15fdddf925fbd1116cc81158d
parentf71aeea9329faf33d7161e6af88e2a94a35edb9f (diff)
CMake: Fix prefix propagation for relocated Qt installations
Consider qtbase built with CMAKE_STAGING_PREFIX=/foo on Windows. If /foo was moved to /bar, non-qtbase repositories did get a staging prefix with drive letter assigned. This is undesirable when DESTDIR is used on installation. Change the implementation of qt_internal_new_prefix to remove the drive letter from the "new prefix" if the "old prefix" did not have a drive letter. Change-Id: I6fb17e690b264920b0dd4204e3b3c30794c7e76e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtBuildInternalsExtra.cmake.in13
1 files changed, 6 insertions, 7 deletions
diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in
index 8257bacf74..d108fbd1cd 100644
--- a/cmake/QtBuildInternalsExtra.cmake.in
+++ b/cmake/QtBuildInternalsExtra.cmake.in
@@ -18,15 +18,14 @@ get_filename_component(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX
# new_prefix: the new prefix for this repository
# orig_prefix: the prefix that was used when qtbase was configured
#
-# On Windows hosts, this function makes sure that we use exactly the original prefix if it points to
-# the same directory as the new one. This is needed for the case where the original prefix is passed
-# without drive letter to support installing with DESTDIR set.
+# On Windows hosts: if the original prefix does not start with a drive letter, this function removes
+# the drive letter from the new prefix. This is needed for installation with DESTDIR set.
function(qt_internal_new_prefix out_var new_prefix orig_prefix)
if(CMAKE_HOST_WIN32)
- get_filename_component(real_new_prefix "${new_prefix}" REALPATH)
- get_filename_component(real_orig_prefix "${orig_prefix}" REALPATH)
- if(real_new_prefix STREQUAL real_orig_prefix)
- set(new_prefix "${orig_prefix}")
+ set(drive_letter_regexp "^[a-zA-Z]:")
+ if(new_prefix MATCHES "${drive_letter_regexp}"
+ AND NOT orig_prefix MATCHES "${drive_letter_regexp}")
+ string(SUBSTRING "${new_prefix}" 2 -1 new_prefix)
endif()
endif()
set(${out_var} "${new_prefix}" PARENT_SCOPE)