summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-18 11:31:59 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-18 12:58:02 +0200
commit87c4812b6c05121d20c36cda485e7b85afe3ca2c (patch)
treee069fc25a9b3a50cd0537ee35f237c7651683b5d /cmake
parented200237604377fee64393ba79c065a2d18c786b (diff)
CMake: Query public target defines when generating module .pri files
Assuage the fears in the previous commit, by actually querying and using the public defines set on a target, rather than hardcoding one single QT_FOO_LIB define + the extra namespace define. This should future-proof .pri file generation for qmake mixing. Amends 3452b08df6a3802c96b06651f9a530d55cbe7477 Task-number: QTBUG-84781 Task-number: QTBUG-84881 Change-Id: Ide68ecf3f89be6d5462cfe43706c27f9cb53394f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index d681459444..d5e00e4c94 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -831,10 +831,11 @@ function(qt_generate_module_pri_file target)
qt_path_join(pri_file_name "${target_path}" "qt_lib_${config_module_name}.pri")
list(APPEND pri_files "${pri_file_name}")
- set(module_extra_defines "")
- if(config_module_name STREQUAL core AND QT_NAMESPACE)
- set(module_extra_defines "QT_NAMESPACE=${QT_NAMESPACE}")
- endif()
+ # Don't use $<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS> genex because that
+ # will compute the transitive list of all defines for a module (so Gui would get Core
+ #defines too). Instead query just the public defines on the target.
+ get_target_property(target_defines "${target}" INTERFACE_COMPILE_DEFINITIONS)
+ list(JOIN target_defines " " joined_target_defines)
file(GENERATE
OUTPUT "${pri_file_name}"
@@ -850,7 +851,7 @@ QT.${config_module_name}.plugin_types = ${module_plugin_types}
QT.${config_module_name}.depends = ${public_module_dependencies}
QT.${config_module_name}.uses =
QT.${config_module_name}.module_config = ${joined_module_internal_config}
-QT.${config_module_name}.DEFINES = QT_${module_define}_LIB ${module_extra_defines}
+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}
QT_CONFIG += ${enabled_features}