Merge topic 'fix-automoc-compile-definitions'

a1b9465 Automoc: Add directory-level COMPILE_DEFINITIONS to command line (#14535)
This commit is contained in:
Brad King 2013-11-05 13:32:15 -05:00 committed by CMake Topic Stage
commit e313d397cd
3 changed files with 25 additions and 5 deletions

View File

@ -1103,6 +1103,8 @@ void cmGlobalGenerator::Generate()
return; return;
} }
this->FinalizeTargetCompileDefinitions();
// Iterate through all targets and set up automoc for those which have // Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set // the AUTOMOC, AUTOUIC or AUTORCC property set
this->CreateQtAutoGeneratorsTargets(); this->CreateQtAutoGeneratorsTargets();
@ -1306,13 +1308,11 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets() void cmGlobalGenerator::FinalizeTargetCompileDefinitions()
{ {
// Construct per-target generator information. // Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
cmGeneratorTargetsType generatorTargets;
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
const std::vector<cmValueWithOrigin> noconfig_compile_definitions = const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
@ -1327,7 +1327,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
{ {
cmTarget* t = &ti->second; cmTarget* t = &ti->second;
{
for (std::vector<cmValueWithOrigin>::const_iterator it for (std::vector<cmValueWithOrigin>::const_iterator it
= noconfig_compile_definitions.begin(); = noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it) it != noconfig_compile_definitions.end(); ++it)
@ -1344,7 +1343,24 @@ void cmGlobalGenerator::CreateGeneratorTargets()
mf->GetProperty(defPropName.c_str())); mf->GetProperty(defPropName.c_str()));
} }
} }
}
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets()
{
// Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
cmGeneratorTargetsType generatorTargets;
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t); cmGeneratorTarget* gt = new cmGeneratorTarget(t);
this->GeneratorTargets[t] = gt; this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt; generatorTargets[t] = gt;

View File

@ -395,6 +395,7 @@ private:
void WriteSummary(); void WriteSummary();
void WriteSummary(cmTarget* target); void WriteSummary(cmTarget* target);
void FinalizeTargetCompileDefinitions();
virtual void PrintCompilerAdvice(std::ostream& os, std::string lang, virtual void PrintCompilerAdvice(std::ostream& os, std::string lang,
const char* envVar); const char* envVar);

View File

@ -16,7 +16,10 @@
#include <QObject> #include <QObject>
class Foo : public QObject class Foo
#ifdef FOO
: public QObject
#endif
{ {
Q_OBJECT Q_OBJECT
public: public: