summaryrefslogtreecommitdiff
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-09-09 16:28:53 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-09-15 22:47:12 +0200
commit74083599f8b175e94789757e478a106ec03750d4 (patch)
tree64cc8d972914da37dfb63500baeb437d24bb0c25 /cmake/QtBuild.cmake
parent828e402a1904c25dc5ea9fa915a5da8559e08560 (diff)
downloadqtbase-74083599f8b175e94789757e478a106ec03750d4.tar.gz
CMake: Rework tool wrapper shell script creation
Instead of creating the tool wrapper shell script only during a Qt build in QtBuild.cmake, ensure it is created any time _qt_internal_wrap_tool_command is called, regardless if we're building Qt or a user project. As a transitional period not to break compatibility, we also need to create the script in QtBuild.cmake, until all usages of QT_TOOL_COMMAND_WRAPPER_PATH are replaced with function calls. Currently such usages are present in qtdeclarative. When considering which bin dirs to add to the script's PATH environment variable assignment, in addition to the build internals relative bin dir, also add QT_BUILD_DIR, QT_ADDITIONAL_PACKAGES_PREFIX_PATH and QT6_INSTALL_PREFIX. QT_BUILD_DIR is important so we always pick up the just-built but not installed libraries in a prefix build when running just-built tools. QT_ADDITIONAL_PACKAGES_PREFIX_PATH is important when building examples as ExternalProjects in prefix builds, to ensure that the not-yet-installed tools and libraries are picked up from the repo build dir, which is passed via QT_ADDITIONAL_PACKAGES_PREFIX_PATH to the external projects. QT6_INSTALL_PREFIX is there in case if the build internals relative dir is located in a different places than the Qt6 package. Pick-to: 6.4 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I4d76fbbc275ca961379971054f87991adac36539 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake22
1 files changed, 5 insertions, 17 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 977018e9dc..29d3d5452a 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -271,23 +271,6 @@ function(qt_setup_tool_path_command)
endfunction()
qt_setup_tool_path_command()
-function(qt_internal_generate_tool_command_wrapper)
- get_property(is_called GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called)
- if(NOT CMAKE_HOST_WIN32 OR is_called)
- return()
- endif()
- set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
- file(TO_NATIVE_PATH "${bindir}" bindir)
- set(tool_command_wrapper_path "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt_setup_tool_path.bat")
- file(WRITE "${tool_command_wrapper_path}" "@echo off
-set PATH=${bindir};%PATH%
-%*")
- set(QT_TOOL_COMMAND_WRAPPER_PATH "${tool_command_wrapper_path}"
- CACHE INTERNAL "Path to the wrapper of the tool commands")
- set_property(GLOBAL PROPERTY _qt_internal_generate_tool_command_wrapper_called TRUE)
-endfunction()
-qt_internal_generate_tool_command_wrapper()
-
# Platform define path, etc.
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
@@ -570,6 +553,11 @@ endif()
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
+# Create tool script wrapper if necessary.
+# TODO: Remove once all direct usages of QT_TOOL_COMMAND_WRAPPER_PATH are replaced with function
+# calls.
+_qt_internal_generate_tool_command_wrapper()
+
# This sets up the poor man's scope finalizer mechanism.
# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
if(CMAKE_VERSION VERSION_LESS "3.19.0")