CMake: Export QT_QPA_DEFAULT_PLATFORM in QtBuildInternalsExtra

The value is useful for QPA plugins built in repos other than qtbase,
to decide if it should be a default plugin or not.
Currently useful for qtwayland.

Also export a qmake value assignment when doing static builds, just
like src/gui/configure.pri does.

Change-Id: I1253f1a7e178b24b16e2615ba20d1e92b0b87b1a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alexandru Croitor 2020-10-26 14:50:23 +01:00
parent c61f90fbe6
commit f65abc6344
2 changed files with 13 additions and 0 deletions

View File

@ -530,6 +530,14 @@ endif()\n")
"set(ECM_ENABLE_SANITIZERS \"${ECM_ENABLE_SANITIZERS}\" CACHE BOOL \"\" FORCE)\n")
endif()
# Save the default qpa platform.
# Used by qtwayland/src/plugins/platforms/qwayland-generic/CMakeLists.txt. Otherwise
# the DEFAULT_IF condition is evaluated incorrectly.
if(DEFINED QT_QPA_DEFAULT_PLATFORM)
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"set(QT_QPA_DEFAULT_PLATFORM \"${QT_QPA_DEFAULT_PLATFORM}\" CACHE STRING \"\")\n")
endif()
# Rpath related things that need to be re-used when building other repos.
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_RPATH}\" CACHE STRING \"\")\n")

View File

@ -240,6 +240,10 @@ function(qt_generate_module_pri_file target)
list(FILTER target_defines EXCLUDE REGEX "\\$<TARGET_PROPERTY:[^,>]+>")
list(JOIN target_defines " " joined_target_defines)
if(NOT QT_BUILD_SHARED_LIBS AND target STREQUAL Gui)
set(extra_assignments "QT_DEFAULT_QPA_PLUGIN = q${QT_QPA_DEFAULT_PLATFORM}")
endif()
file(GENERATE
OUTPUT "${pri_file_name}"
CONTENT
@ -257,6 +261,7 @@ QT.${config_module_name}.module_config = ${joined_module_internal_config}
QT.${config_module_name}.DEFINES = ${joined_target_defines}
QT.${config_module_name}.enabled_features = ${enabled_features}
QT.${config_module_name}.disabled_features = ${disabled_features}${module_build_config}
${extra_assignments}
QT_CONFIG += ${enabled_features}
QT_MODULES += ${config_module_name_base}
"