diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2023-04-03 14:55:56 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2023-04-09 10:51:15 (GMT) |
commit | c5c3aff1f5aa36d44f3c639726dd36eedc28f823 (patch) | |
tree | 30f3e3fcb73b0085a8de5afebde91c64c75fd9d9 /Source | |
parent | 69cf9700e6873a86094fe66c5091c21b909e1969 (diff) | |
download | CMake-c5c3aff1f5aa36d44f3c639726dd36eedc28f823.zip CMake-c5c3aff1f5aa36d44f3c639726dd36eedc28f823.tar.gz CMake-c5c3aff1f5aa36d44f3c639726dd36eedc28f823.tar.bz2 |
Autogen: Add INTERFACE_AUTOMOC_MACRO_NAMES target property
Add this target property to specify macro names that propagate to
dependents as `AUTOMOC_MACRO_NAMES`. The dependents will automatically
generate MOC files for source files that contain the inherited macro
names.
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
Fixes: #19679
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 19 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index caf8ac2..437ae69 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -106,6 +106,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gte, cmGeneratorExpression::BuildInterface, properties); + this->PopulateInterfaceProperty("INTERFACE_AUTOMOC_MACRO_NAMES", gte, + cmGeneratorExpression::BuildInterface, + properties); this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte, cmGeneratorExpression::BuildInterface, properties); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index def8227..51c91f3 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -110,6 +110,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gt, cmGeneratorExpression::InstallInterface, properties); + this->PopulateInterfaceProperty("INTERFACE_AUTOMOC_MACRO_NAMES", gt, + cmGeneratorExpression::InstallInterface, + properties); this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gt, cmGeneratorExpression::InstallInterface, properties); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ba4c4d8..782c154 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -28,8 +28,10 @@ #include "cmAlgorithms.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" +#include "cmEvaluatedTargetProperty.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" +#include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkItem.h" @@ -1691,6 +1693,23 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() info.SetArray("MOC_OPTIONS", this->Moc.Options); info.SetBool("MOC_RELAXED_MODE", this->Moc.RelaxedMode); info.SetBool("MOC_PATH_PREFIX", this->Moc.PathPrefix); + + cmGeneratorExpressionDAGChecker dagChecker( + this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr); + EvaluatedTargetPropertyEntries InterfaceAutoMocMacroNamesEntries; + + AddInterfaceEntries(this->GenTarget, this->ConfigDefault, + "INTERFACE_AUTOMOC_MACRO_NAMES", "CXX", &dagChecker, + InterfaceAutoMocMacroNamesEntries, + IncludeRuntimeInterface::Yes); + + for (auto const& entry : InterfaceAutoMocMacroNamesEntries.Entries) { + this->Moc.MacroNames.insert(this->Moc.MacroNames.end(), + entry.Values.begin(), entry.Values.end()); + } + this->Moc.MacroNames.erase(cmRemoveDuplicates(this->Moc.MacroNames), + this->Moc.MacroNames.end()); + info.SetArray("MOC_MACRO_NAMES", this->Moc.MacroNames); info.SetArrayArray( "MOC_DEPEND_FILTERS", this->Moc.DependFilters, |