Fix CMake moc scanner to look for new macro Q_NAMESPACE_EXPORT

f66c1db16c in qtbase introduced a new
macro that the moc scanner has to look for.

Set an explicit list of macros to look for in the
CMAKE_AUTOMOC_MACRO_NAMES property of every target that has AUTOMOC
enabled, otherwise CMake AUTOMOC won't run moc on files that contain
the new macro.

Change-Id: Id991a70d773cef66716621803a88e96b44a80650
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-07-11 16:23:54 +02:00
parent a5b78a3660
commit 078cd61751

View File

@ -735,6 +735,13 @@ function(qt_enable_autogen_tool target tool enable)
list(REMOVE_ITEM autogen_target_depends ${tool_target_name})
endif()
# f66c1db16c050c9d685a44a38ad7c5cf9f6fcc96 in qtbase introduced a new macro
# that the moc scanner has to look for. Inform the CMake moc scanner about it.
if(tool STREQUAL "moc" AND enable)
set_target_properties("${target}" PROPERTIES
AUTOMOC_MACRO_NAMES "Q_OBJECT;Q_GADGET;Q_NAMESPACE;Q_NAMESPACE_EXPORT")
endif()
set_target_properties("${target}"
PROPERTIES
AUTO${captitalAutogenTool} "${enable}"