summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtBuild.cmake15
-rw-r--r--src/corelib/Qt6CoreMacros.cmake24
2 files changed, 39 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index f22aad3e34..18027848c2 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -260,9 +260,24 @@ function(qt_setup_tool_path_command)
list(APPEND command COMMAND)
list(APPEND command set PATH=${bindir}$<SEMICOLON>%PATH%)
set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE)
+ # QT_TOOL_PATH_SETUP_COMMAND is deprecated. Please use _qt_internal_wrap_tool_command
+ # instead.
endfunction()
qt_setup_tool_path_command()
+function(qt_internal_generate_tool_command_wrapper)
+ if(NOT CMAKE_HOST_WIN32 OR DEFINED QT_TOOL_COMMAND_WRAPPER_PATH)
+ return()
+ endif()
+ set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
+ file(TO_NATIVE_PATH "${bindir}" bindir)
+ set(QT_TOOL_COMMAND_WRAPPER_PATH "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt_setup_tool_path.bat"
+ CACHE INTERNAL "Path to the wrapper of the tool commands")
+ file(GENERATE OUTPUT "${QT_TOOL_COMMAND_WRAPPER_PATH}" CONTENT
+ "@echo off\r\nset PATH=${bindir}$<SEMICOLON>%PATH%\r\n%*")
+endfunction()
+qt_internal_generate_tool_command_wrapper()
+
# Platform define path, etc.
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index d6a06d930d..804718df86 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -1720,6 +1720,30 @@ function(_qt_internal_apply_strict_cpp target)
endif()
endfunction()
+# Wraps a tool command with a script that contains the necessary environment for the tool to run
+# correctly.
+# _qt_internal_wrap_tool_command(var <SET|APPEND> <command> [args...])
+# Arguments:
+# APPEND Selects the 'append' mode for the out_variable argument.
+# SET Selects the 'set' mode for the out_variable argument.
+function(_qt_internal_wrap_tool_command out_variable action)
+ set(append FALSE)
+ if(action STREQUAL "APPEND")
+ set(append TRUE)
+ elseif(NOT action STREQUAL "SET")
+ message(FATAL_ERROR "Invalid action specified ${action}. Supported actions: SET, APPEND")
+ endif()
+
+ set(cmd COMMAND ${QT_TOOL_COMMAND_WRAPPER_PATH} ${ARGN})
+
+ if(append)
+ list(APPEND ${out_variable} ${cmd})
+ else()
+ set(${out_variable} ${cmd})
+ endif()
+ set(${out_variable} "${${out_variable}}" PARENT_SCOPE)
+endfunction()
+
# Copies properties of the dependency to the target.
# Arguments:
# PROPERTIES list of properties to copy. If not specified the following properties are copied