Avoid resetting CMAKE_AUTOMOC_MACRO_NAMES

Instead of overwriting the CMAKE_AUTOMOC_MACRO_NAMES, we try to append
our desired moc names to it, and don't get rid of what's there.

Thanks for Friedrich W. H. Kossebau for filling a descriptive bug report
and offering a solution as well.

Fixes: QTBUG-110497
Change-Id: I582af431151cacfe24085b890ae9dba0a0e53f3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 38ee9ee8497291c899c2a72e0ed24bfffe9ced4e)
This commit is contained in:
Amir Masoud Abdol 2023-02-28 10:32:13 +01:00
parent 2c117edf7c
commit 32124d3705

View File

@ -26,7 +26,8 @@ if (NOT QT_NO_CREATE_TARGETS)
set_property(TARGET ${__qt_core_target} PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
endif()
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES Q_OBJECT Q_GADGET Q_GADGET_EXPORT Q_NAMESPACE Q_NAMESPACE_EXPORT)
list(REMOVE_DUPLICATES CMAKE_AUTOMOC_MACRO_NAMES)
include("${CMAKE_CURRENT_LIST_DIR}/QtInstallPaths.cmake")