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>
This commit is contained in:
parent
d7fd684861
commit
2299b61d0c
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user