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>
This commit is contained in:
parent
f71aeea932
commit
8b5cce6911
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user