From d1446ca7a0d1de4ede995d64deef057c741ef0c2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Sep 2012 11:45:40 +0200 Subject: Append the COMPILE_DEFINITIONS from the Makefile to all targets. This way we don't need to check the definitions from the Makefile when generating later, and can more easily add generator expressions. Duplication is not a problem as the definitions are de-duplicated before generating. --- Source/cmGlobalGenerator.cxx | 19 +++++++++++++++++++ Source/cmLocalVisualStudio6Generator.cxx | 16 ---------------- Source/cmMakefileTargetGenerator.cxx | 4 ---- Source/cmNinjaTargetGenerator.cxx | 6 ------ 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 766fcb7..ac75933 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1078,11 +1078,30 @@ void cmGlobalGenerator::CreateGeneratorTargets() cmGeneratorTargetsType generatorTargets; cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + const char *noconfig_compile_definitions = + mf->GetProperty("COMPILE_DEFINITIONS"); + + std::vector configs; + mf->GetConfigurations(configs); + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + + { + t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions); + for(std::vector::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + t->AppendProperty(defPropName.c_str(), + mf->GetProperty(defPropName.c_str())); + } + } + cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d6af26b..adacd3b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1681,22 +1681,6 @@ void cmLocalVisualStudio6Generator this->AppendDefines( definesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - this->AppendDefines( - debugDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG")); - this->AppendDefines( - releaseDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE")); - this->AppendDefines( - minsizeDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); - this->AppendDefines( - debugrelDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); - - this->AppendDefines( - definesSet, target.GetProperty("COMPILE_DEFINITIONS")); this->AppendDefines( debugDefinesSet, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 063a099..cde3299 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -302,15 +302,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str())); - this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty(defPropName.c_str())); std::string definesString; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a384cfb..d4ab133 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -195,9 +195,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, @@ -207,9 +204,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language) defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty(defPropName.c_str())); - this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, -- cgit v0.12