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.
This commit is contained in:
Stephen Kelly 2012-09-17 11:45:40 +02:00
parent 290e92ada8
commit d1446ca7a0
4 changed files with 19 additions and 26 deletions

View File

@ -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<std::string> 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<std::string>::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);

View File

@ -1679,22 +1679,6 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
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"));

View File

@ -301,15 +301,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()));

View File

@ -193,9 +193,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"));
@ -205,9 +202,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
{
std::string defPropName = "COMPILE_DEFINITIONS_";
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()));