CMake: Don't propagate private defines for Qt header modules

Interface libraries like our Qt header modules should not propagated
private defines which are meant only for building a specific Qt
module, and in the case of a header module there is nothing to build.

Exclude the usual private defines we set in qt_add_module for header
modules. This also fixes the content of header module .pri files.

Change-Id: I0791ebdb73e8b020ddb8116433ed36c7b3d71303
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Alexandru Croitor 2020-07-03 17:33:34 +02:00
parent 864466d2e5
commit 7067b2ca6e
1 changed files with 15 additions and 7 deletions

View File

@ -2843,6 +2843,20 @@ function(qt_add_module target)
add_custom_target(${target}_timestamp ALL DEPENDS "${timestamp_file}")
endif()
set(defines_for_extend_target "")
if(NOT arg_HEADER_MODULE)
list(APPEND defines_for_extend_target
QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
QT_USE_QSTRINGBUILDER
QT_DEPRECATED_WARNINGS
QT_BUILDING_QT
QT_BUILD_${module_define}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
"${deprecation_define}"
)
endif()
qt_extend_target("${target}"
${header_module}
SOURCES ${arg_SOURCES}
@ -2855,13 +2869,7 @@ function(qt_add_module target)
QT_${module_define}_LIB
DEFINES
${arg_DEFINES}
QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
QT_USE_QSTRINGBUILDER
QT_DEPRECATED_WARNINGS
QT_BUILDING_QT
QT_BUILD_${module_define}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
"${deprecation_define}"
${defines_for_extend_target}
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
LIBRARIES ${arg_LIBRARIES} Qt::PlatformModuleInternal
PRIVATE_MODULE_INTERFACE ${arg_PRIVATE_MODULE_INTERFACE}