From 87c4812b6c05121d20c36cda485e7b85afe3ca2c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 18 Jun 2020 11:31:59 +0200 Subject: 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 --- cmake/QtBuild.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cmake/QtBuild.cmake') 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 $ 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} -- cgit v1.2.3