mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
Autogen: Define all macro names in CMAKE_AUTOMOC_MACRO_NAMES
Instead of adding `Q_OBJECT` and `Q_GADGET` to the macro search list in `Source/cmQtAutoGenerators.cxx`, add them in `Modules/CMakeGenericSystem.cmake` to the default value of `CMAKE_AUTOMOC_MACRO_NAMES`. Also add `Q_NAMESPACE` to `CMAKE_AUTOMOC_MACRO_NAMES` which closes #17299.
This commit is contained in:
@@ -23,6 +23,7 @@ set(CMAKE_DL_LIBS "dl")
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
||||
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
|
||||
|
||||
# basically all general purpose OSs support shared libs
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
||||
|
||||
@@ -149,12 +149,6 @@ cmQtAutoGenerators::cmQtAutoGenerators()
|
||||
}
|
||||
}
|
||||
|
||||
// Moc macro filters
|
||||
this->MocMacroFilters.emplace_back(
|
||||
"Q_OBJECT", "[\n][ \t]*{?[ \t]*Q_OBJECT[^a-zA-Z0-9_]");
|
||||
this->MocMacroFilters.emplace_back(
|
||||
"Q_GADGET", "[\n][ \t]*{?[ \t]*Q_GADGET[^a-zA-Z0-9_]");
|
||||
|
||||
// Precompile regular expressions
|
||||
this->MocRegExpInclude.compile(
|
||||
"[\n][ \t]*#[ \t]*include[ \t]+"
|
||||
@@ -326,7 +320,7 @@ bool cmQtAutoGenerators::InitInfoFile(cmMakefile* makefile,
|
||||
InfoGetList("AM_MOC_MACRO_NAMES");
|
||||
for (std::string const& item : MocMacroNames) {
|
||||
this->MocMacroFilters.emplace_back(
|
||||
item, ("[^a-zA-Z0-9_]" + item).append("[^a-zA-Z0-9_]"));
|
||||
item, ("[\n][ \t]*{?[ \t]*" + item).append("[^a-zA-Z0-9_]"));
|
||||
}
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user