summaryrefslogtreecommitdiffstats
path: root/cmake/QtQmakeHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-03-02 17:38:38 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-03-04 01:58:10 +0100
commiteec317a138dd69449cf9add63751d799b461c1b1 (patch)
tree4e7a6180663875d22fda8a253fb2d193add571fc /cmake/QtQmakeHelpers.cmake
parente440fec7fc729342dce7c8421618a95dab11a36b (diff)
CMake: Generate wrapper shell scripts for all hosts when requested
This is useful for Qt for Android builds, where we want to build Qt on a single host, but make the Qt installation usable on any host (Windows, Linux, macOS). There are only two flavors of shell scripts, unix ones that use sh and Windows batch files. If Qt is configured with -DQT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS=ON then we generate both of them regardless of the current host platform. Note that the target_qt.conf file still needs to be patched to specify a correct HostSpec value so that qmake operates correctly. Other target_qt.conf values might also need path adjustments depending on use case (like HostPrefix and HostData). Pick-to: 6.2 6.3 Task-number: QTBUG-101357 Change-Id: Ic86caaa8b318467528cc82dc7fbfecde998cdb71 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtQmakeHelpers.cmake')
-rw-r--r--cmake/QtQmakeHelpers.cmake35
1 files changed, 24 insertions, 11 deletions
diff --git a/cmake/QtQmakeHelpers.cmake b/cmake/QtQmakeHelpers.cmake
index 668702f968..0f623254fb 100644
--- a/cmake/QtQmakeHelpers.cmake
+++ b/cmake/QtQmakeHelpers.cmake
@@ -130,25 +130,38 @@ HostSpec=${QT_QMAKE_HOST_MKSPEC}
qt_install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${qt_conf_path}"
DESTINATION "${INSTALL_BINDIR}")
+ if(QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS)
+ set(hosts "unix" "non-unix")
+ elseif(CMAKE_HOST_UNIX)
+ set(hosts "unix")
+ else()
+ set(hosts "non-unix")
+ endif()
+
set(wrapper_prefix)
- set(wrapper_extension)
if(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
# Avoid collisions with the cross-compiled qmake/qtpaths binaries.
set(wrapper_prefix "host-")
endif()
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- set(wrapper_extension ".bat")
- endif()
- 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}")
- 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}")
+ foreach(host_type ${hosts})
+ foreach(tool_name qmake qtpaths)
+ set(wrapper_extension)
+
+ if(host_type STREQUAL "non-unix")
+ set(wrapper_extension ".bat")
+ endif()
+
+ set(wrapper_in_file
+ "${CMAKE_CURRENT_SOURCE_DIR}/bin/qmake-and-qtpaths-wrapper${wrapper_extension}.in")
+
+ 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()
endforeach()
endfunction()