diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-08-15 23:45:05 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-08-15 23:45:05 (GMT) |
commit | 50cd6cef925a53dfbbb820ae7343981dcf00f36c (patch) | |
tree | 68eb8f5c223488d644cec17dad2224c0aa09bff9 /Source/cmGlobalGenerator.cxx | |
parent | cbaac2a587d8457b69d832e2c63de8fb755ec64d (diff) | |
download | CMake-50cd6cef925a53dfbbb820ae7343981dcf00f36c.zip CMake-50cd6cef925a53dfbbb820ae7343981dcf00f36c.tar.gz CMake-50cd6cef925a53dfbbb820ae7343981dcf00f36c.tar.bz2 |
Move automoc processing from add_executable/library to cmGlobalGenerator
Now automoc is enabled by setting the AUTOMOC target property to true,
instead of using the AUTOMOC keyword in add_executable() or add_library()
Alex
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f37b054..3016f5a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -18,6 +18,7 @@ #include "cmExternalMakefileProjectGenerator.h" #include "cmake.h" #include "cmMakefile.h" +#include "cmQtAutomoc.h" #include "cmSourceFile.h" #include "cmVersion.h" #include "cmExportInstallFileGenerator.h" @@ -832,6 +833,10 @@ void cmGlobalGenerator::Generate() return; } + // Iterate through all targets and set up automoc for those which have + // the AUTOMOC property set + this->CreateAutomocTargets(); + // For each existing cmLocalGenerator unsigned int i; @@ -950,6 +955,33 @@ bool cmGlobalGenerator::CheckTargets() return true; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::CreateAutomocTargets() +{ + for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + { + cmTargets& targets = + this->LocalGenerators[i]->GetMakefile()->GetTargets(); + for(cmTargets::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + cmTarget& target = ti->second; + if(target.GetType() == cmTarget::EXECUTABLE || + target.GetType() == cmTarget::STATIC_LIBRARY || + target.GetType() == cmTarget::SHARED_LIBRARY || + target.GetType() == cmTarget::MODULE_LIBRARY) + { + if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported()) + { + cmQtAutomoc automoc; + automoc.SetupAutomocTarget(&target); + } + } + } + } +} + + void cmGlobalGenerator::CheckLocalGenerators() { std::map<cmStdString, cmStdString> notFoundMap; |