diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-31 11:11:31 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-31 13:32:51 +0200 |
commit | 88886f193230292f38987ac4f1503753f50786f0 (patch) | |
tree | ccf82bdbfd98d0194b875f134b8320f8326d536b | |
parent | 68ab295ec382cfdd64262e585df734cac077a4d0 (diff) | |
download | qtbase-88886f193230292f38987ac4f1503753f50786f0.tar.gz |
Fix DESTDIR support on Windows for versioned hard-links
On Windows, we need to strip drive letter and colon before prepending
DESTDIR when creating our versioned hard links.
This fixes CI submodule updates.
Pick-to: dev
Change-Id: I41bc5f27b714ef74d3fadc4a0fb16c3d8b20da1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | cmake/QtInstallHelpers.cmake | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmake/QtInstallHelpers.cmake b/cmake/QtInstallHelpers.cmake index 1f1fb84634..30962b84e2 100644 --- a/cmake/QtInstallHelpers.cmake +++ b/cmake/QtInstallHelpers.cmake @@ -136,13 +136,25 @@ function(qt_internal_install_versioned_link install_dir target) return() endif() - qt_path_join(install_base_file_path "$ENV\{DESTDIR}$\{CMAKE_INSTALL_PREFIX}" + qt_path_join(install_base_file_path "$\{qt_full_install_prefix}" "${install_dir}" "$<TARGET_FILE_BASE_NAME:${target}>") set(original "${install_base_file_path}$<TARGET_FILE_SUFFIX:${target}>") set(linkname "${install_base_file_path}${PROJECT_VERSION_MAJOR}$<TARGET_FILE_SUFFIX:${target}>") - set(code - "message(STATUS \"Creating hard link ${original} -> ${linkname}\")" - "file(CREATE_LINK \"${original}\" \"${linkname}\" COPY_ON_ERROR)") + set(code "set(qt_full_install_prefix \"$\{CMAKE_INSTALL_PREFIX}\")" + " if(NOT \"$ENV\{DESTDIR}\" STREQUAL \"\")" + ) + if(CMAKE_HOST_WIN32) + list(APPEND code + " if(qt_full_install_prefix MATCHES \"^[a-zA-Z]:\")" + " string(SUBSTRING \"$\{qt_full_install_prefix}\" 2 -1 qt_full_install_prefix)" + " endif()" + ) + endif() + list(APPEND code + " string(PREPEND qt_full_install_prefix \"$ENV\{DESTDIR}\")" + " endif()" + " message(STATUS \"Creating hard link ${original} -> ${linkname}\")" + " file(CREATE_LINK \"${original}\" \"${linkname}\" COPY_ON_ERROR)") if(QT_GENERATOR_IS_MULTI_CONFIG) # Wrap the code in a configuration check, |