From 078cd61751aeaa310d35a3d596a21a36004a1a0f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 11 Jul 2019 16:23:54 +0200 Subject: [PATCH] Fix CMake moc scanner to look for new macro Q_NAMESPACE_EXPORT f66c1db16c050c9d685a44a38ad7c5cf9f6fcc96 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 Reviewed-by: Simon Hausmann --- cmake/QtBuild.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index df9e9008ce..fc2007517a 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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}"