diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in index 8257bacf74d..d108fbd1cd3 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)