diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-26 14:38:40 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-29 12:47:39 +0200 |
commit | 2299b61d0ca83d7066d476a9930c6dfab8e8beb3 (patch) | |
tree | 0e8d3d33d041eba756415c57e1a4f04d9dd18978 /cmake | |
parent | d7fd6848612760124871f0f3b55917250d078dd5 (diff) |
CMake: Write gcc sysroot flags to qconfig.pri
For a cross-built, gcc-built Qt, the qmake build writes code into
qconfig.pri that adds the --sysroot flag to compiler and linker flags.
Follow suit in the CMake build.
To keep the diff small between the qmake-generated and CMake-generated
qconfig.pri files, the sysroot code is added at the top of
qconfig.pri, which is the reason for the new 'content' string variable.
Change-Id: I50649100e4368be64bf98ca19e46312e3ebf619d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index a2463fdccf..0f0a94ff54 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1147,6 +1147,29 @@ function(qt_generate_global_config_pri_file) list(JOIN corrected_public_config " " public_config_joined) list(JOIN corrected_qt_public_config " " qt_public_config_joined) + set(content "") + if(GCC OR CLANG AND NOT "${CMAKE_SYSROOT}" STREQUAL "") + string(APPEND content "!host_build { + QMAKE_CFLAGS += --sysroot=\$\$[QT_SYSROOT] + QMAKE_CXXFLAGS += --sysroot=\$\$[QT_SYSROOT] + QMAKE_LFLAGS += --sysroot=\$\$[QT_SYSROOT] +} +") + endif() + + string(APPEND content "QT_ARCH = ${TEST_architecture_arch} +QT_BUILDABI = ${TEST_buildAbi} +QT.global.enabled_features = ${corrected_enabled_features} +QT.global.disabled_features = ${corrected_disabled_features} +QT.global.disabled_features += release build_all +QT_CONFIG += ${qt_public_config_joined} +CONFIG += ${config_entries} ${public_config_joined} +QT_VERSION = ${PROJECT_VERSION} +QT_MAJOR_VERSION = ${PROJECT_VERSION_MAJOR} +QT_MINOR_VERSION = ${PROJECT_VERSION_MINOR} +QT_PATCH_VERSION = ${PROJECT_VERSION_PATCH} +") + set(extra_statements "") if(QT_NAMESPACE) list(APPEND extra_statements "QT_NAMESPACE = ${QT_NAMESPACE}") @@ -1192,25 +1215,13 @@ function(qt_generate_global_config_pri_file) list(APPEND extra_statements "QT_EDITION = Open Source") if(extra_statements) - string (REPLACE ";" "\n" extra_statements "${extra_statements}") + string(REPLACE ";" "\n" extra_statements "${extra_statements}") + string(APPEND content "\n${extra_statements}") endif() file(GENERATE OUTPUT "${qconfig_pri_target_path}" - CONTENT - "QT_ARCH = ${TEST_architecture_arch} -QT_BUILDABI = ${TEST_buildAbi} -QT.global.enabled_features = ${corrected_enabled_features} -QT.global.disabled_features = ${corrected_disabled_features} -QT.global.disabled_features += release build_all -QT_CONFIG += ${qt_public_config_joined} -CONFIG += ${config_entries} ${public_config_joined} -QT_VERSION = ${PROJECT_VERSION} -QT_MAJOR_VERSION = ${PROJECT_VERSION_MAJOR} -QT_MINOR_VERSION = ${PROJECT_VERSION_MINOR} -QT_PATCH_VERSION = ${PROJECT_VERSION_PATCH} -${extra_statements} -" + CONTENT "${content}" ) qt_install(FILES "${qconfig_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR}) endfunction() |