summaryrefslogtreecommitdiffstats
path: root/cmake/QtSetup.cmake
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-04-27 15:04:57 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-06-02 22:42:15 +0200
commit5a779a4ad350accadc4337d332eedb29ba1cc26b (patch)
tree50263a99b188539a28aaf733a07bb0072eab8fa8 /cmake/QtSetup.cmake
parent47c6466d0acc6d8d733b4fdbaf980a60bbfc93ef (diff)
CMake: Make it possible to build tools when cross-compiling
This patch allows tools to be built for the target platform when the QT_BUILD_TOOLS_WHEN_CROSSCOMPILING parameter is set at configuration time. To avoid naming conflicts, the target tools are suffixed with "_native". The qt_get_tool_target_name() function can be used to get the tool name for both scenarios (cross and non-cross compilation). Extend pro2cmake to refer to the right target name for tools. The relevant write_XXX functions have a new target_ref parameter that will be "${target_name}" for tools and literally the target name for everything else. Fixes: QTBUG-81901 Change-Id: If4efbc1fae07a4a3a044dd09c9c06be6d517825e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r--cmake/QtSetup.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 39142fa332..d892273443 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -125,8 +125,13 @@ option(QT_NO_MAKE_TESTS "Should tests be built as part of the default 'all' targ
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as well.
# Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a qtNomakeTools() call.
+set(qt_no_make_tools_default OFF)
+if(CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
+ set(qt_no_make_tools_default ON)
+endif()
option(QT_NO_MAKE_TOOLS "Should tools be built as part of the default 'all' target."
- "${CMAKE_CROSSCOMPILING}")
+ "${qt_no_make_tools_default}")
+unset(qt_no_make_tools_default)
include(CTest)
enable_testing()