diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-04-27 15:04:57 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-02 22:42:15 +0200 |
commit | 5a779a4ad350accadc4337d332eedb29ba1cc26b (patch) | |
tree | 50263a99b188539a28aaf733a07bb0072eab8fa8 /qmake | |
parent | 47c6466d0acc6d8d733b4fdbaf980a60bbfc93ef (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 'qmake')
-rw-r--r-- | qmake/.prev_CMakeLists.txt | 16 | ||||
-rw-r--r-- | qmake/CMakeLists.txt | 22 |
2 files changed, 21 insertions, 17 deletions
diff --git a/qmake/.prev_CMakeLists.txt b/qmake/.prev_CMakeLists.txt index 63b34a0970..2bfc56b37f 100644 --- a/qmake/.prev_CMakeLists.txt +++ b/qmake/.prev_CMakeLists.txt @@ -4,7 +4,8 @@ ## qmake Tool: ##################################################################### -qt_add_tool(qmake +qt_get_tool_target_name(target_name qmake) +qt_add_tool(${target_name} SOURCES ../src/3rdparty/pcre2/src/config.h ../src/3rdparty/pcre2/src/pcre2.h @@ -169,7 +170,7 @@ qt_add_tool(qmake ## Scopes: ##################################################################### -qt_extend_target(qmake CONDITION WIN32 +qt_extend_target(${target_name} CONDITION WIN32 SOURCES ../src/corelib/global/qoperatingsystemversion_win.cpp ../src/corelib/io/qfilesystemengine_win.cpp @@ -193,7 +194,7 @@ qt_extend_target(qmake CONDITION WIN32 ole32 ) -qt_extend_target(qmake CONDITION UNIX +qt_extend_target(${target_name} CONDITION UNIX SOURCES ../src/corelib/io/qfilesystemengine_unix.cpp ../src/corelib/io/qfilesystemiterator_unix.cpp @@ -202,7 +203,7 @@ qt_extend_target(qmake CONDITION UNIX ../src/corelib/text/qlocale_unix.cpp ) -qt_extend_target(qmake CONDITION MACOS +qt_extend_target(${target_name} CONDITION MACOS SOURCES qcore_foundation.mm qcore_mac.mm @@ -216,13 +217,16 @@ qt_extend_target(qmake CONDITION MACOS -fconstant-cfstrings ) -qt_extend_target(qmake CONDITION MINGW AND WIN32 +qt_extend_target(${target_name} CONDITION MINGW AND WIN32 PUBLIC_LIBRARIES uuid ) -qt_extend_target(qmake CONDITION CLANG AND WIN32 +qt_extend_target(${target_name} CONDITION CLANG AND WIN32 COMPILE_OPTIONS -Wno-microsoft-enum-value -fms-compatibility-version=19.00.23506 ) + +#### Keys ignored in scope 10:.:../src/3rdparty/pcre2:../src/3rdparty/pcre2/pcre2.pri:QT_FEATURE_intelcet: +# QMAKE_CFLAGS = "$$QMAKE_CFLAGS_SHSTK" diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt index 253040d402..c12cb03237 100644 --- a/qmake/CMakeLists.txt +++ b/qmake/CMakeLists.txt @@ -4,7 +4,8 @@ ## qmake Tool: ##################################################################### -qt_add_tool(qmake +qt_get_tool_target_name(target_name qmake) +qt_add_tool(${target_name} NO_QT # special case TOOLS_TARGET Core # special case # GUI # special case: remove this @@ -187,7 +188,7 @@ qt_add_tool(qmake ## Scopes: ##################################################################### -qt_extend_target(qmake CONDITION WIN32 +qt_extend_target(${target_name} CONDITION WIN32 SOURCES ../src/corelib/global/qoperatingsystemversion_win.cpp ../src/corelib/io/qfilesystemengine_win.cpp @@ -211,7 +212,7 @@ qt_extend_target(qmake CONDITION WIN32 ole32 ) -qt_extend_target(qmake CONDITION UNIX +qt_extend_target(${target_name} CONDITION UNIX SOURCES ../src/corelib/io/qfilesystemengine_unix.cpp ../src/corelib/io/qfilesystemiterator_unix.cpp @@ -220,7 +221,7 @@ qt_extend_target(qmake CONDITION UNIX ../src/corelib/text/qlocale_unix.cpp ) -qt_extend_target(qmake CONDITION MACOS +qt_extend_target(${target_name} CONDITION MACOS SOURCES ../src/corelib/kernel/qcore_foundation.mm # special case ../src/corelib/kernel/qcore_mac.mm # special case @@ -251,26 +252,25 @@ extend_target(qmake CONDITION WIN32 ole32 advapi32 kernel32 netapi32 ) -qt_extend_target(qmake CONDITION MINGW AND WIN32 +qt_extend_target(${target_name} CONDITION MINGW AND WIN32 PUBLIC_LIBRARIES uuid ) -qt_extend_target(qmake CONDITION CLANG AND WIN32 +qt_extend_target(${target_name} CONDITION CLANG AND WIN32 COMPILE_OPTIONS "-fms-compatibility-version=19.00.23506" "-Wno-microsoft-enum-value" ) # special case: -set_target_properties(qmake PROPERTIES +set_target_properties(${target_name} PROPERTIES AUTOMOC OFF AUTORCC OFF AUTOUIC OFF ) -qt_internal_add_link_flags_gc_sections(qmake PRIVATE) # special case - -qt_enable_msvc_cplusplus_define(qmake PUBLIC) # special case -qt_skip_warnings_are_errors(qmake) # special case +qt_internal_add_link_flags_gc_sections(${target_name} PRIVATE) # special case +qt_enable_msvc_cplusplus_define(${target_name} PUBLIC) # special case +qt_skip_warnings_are_errors(${target_name}) # special case |