summaryrefslogtreecommitdiffstats
path: root/cmake/QtQmakeHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-11-05 13:31:35 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-11-08 13:41:03 +0100
commit71e490f0baee0d27a45a17886c48f5defbbaea42 (patch)
tree3705e0ce5ff3c2488b9e2f0a6d89c77b6865892a /cmake/QtQmakeHelpers.cmake
parentc0bc4c7638d8b7d46f8cb3175ddde2a59ca63983 (diff)
Provide a qtpaths wrapper script when cross-building Qt
The qtpaths tool is supposed to replace "qmake -query", and it must be available for cross-builds as a wrapper script like qmake. Re-use the existing facility for creating the qmake wrapper script for creating the qtpaths wrapper script. Pick-to: 6.2 Fixes: QTBUG-97821 Change-Id: I460bae61a531994422e1c0fba09c79e4aa65713f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtQmakeHelpers.cmake')
-rw-r--r--cmake/QtQmakeHelpers.cmake32
1 files changed, 17 insertions, 15 deletions
diff --git a/cmake/QtQmakeHelpers.cmake b/cmake/QtQmakeHelpers.cmake
index 3fb126344d..668702f968 100644
--- a/cmake/QtQmakeHelpers.cmake
+++ b/cmake/QtQmakeHelpers.cmake
@@ -68,10 +68,10 @@ function(qt_generate_qconfig_cpp in_file out_file)
endfunction()
# In the cross-compiling case, creates a wrapper around the host Qt's
-# qmake executable. Also creates a qmake configuration file that sets
+# qmake and qtpaths executables. Also creates a qmake configuration file that sets
# up the host qmake's properties for cross-compiling with this Qt
# build.
-function(qt_generate_qmake_wrapper_for_target)
+function(qt_generate_qmake_and_qtpaths_wrapper_for_target)
if(NOT CMAKE_CROSSCOMPILING)
return()
endif()
@@ -127,27 +127,29 @@ TargetSpec=${QT_QMAKE_TARGET_MKSPEC}
HostSpec=${QT_QMAKE_HOST_MKSPEC}
")
file(GENERATE OUTPUT "${qt_conf_path}" CONTENT "${content}")
+ qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${qt_conf_path}"
+ DESTINATION "${INSTALL_BINDIR}")
- qt_path_join(qmake_wrapper_in_file "${CMAKE_CURRENT_SOURCE_DIR}/bin/qmake-wrapper-for-target")
- set(qmake_wrapper "qmake")
+ set(wrapper_prefix)
+ set(wrapper_extension)
if(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
- # Avoid collisions with the cross-compiled qmake binary.
- string(PREPEND qmake_wrapper "host-")
+ # Avoid collisions with the cross-compiled qmake/qtpaths binaries.
+ set(wrapper_prefix "host-")
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- string(APPEND qmake_wrapper_in_file ".bat")
- string(APPEND qmake_wrapper ".bat")
+ set(wrapper_extension ".bat")
endif()
- string(APPEND qmake_wrapper_in_file ".in")
+ set(wrapper_in_file
+ "${CMAKE_CURRENT_SOURCE_DIR}/bin/qmake-and-qtpaths-wrapper${wrapper_extension}.in")
set(host_qt_bindir "${host_prefix}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}")
- qt_path_join(qmake_wrapper "preliminary" "${qmake_wrapper}")
- configure_file("${qmake_wrapper_in_file}" "${qmake_wrapper}" @ONLY)
- qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${qt_conf_path}"
- DESTINATION "${INSTALL_BINDIR}")
- qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${qmake_wrapper}"
- DESTINATION "${INSTALL_BINDIR}")
+ foreach(tool_name qmake qtpaths)
+ set(wrapper "preliminary/${wrapper_prefix}${tool_name}${wrapper_extension}")
+ configure_file("${wrapper_in_file}" "${wrapper}" @ONLY)
+ qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${wrapper}"
+ DESTINATION "${INSTALL_BINDIR}")
+ endforeach()
endfunction()
# Transforms a CMake Qt module name to a qmake Qt module name.