Add a wrapper for accessing config-specific compile-definitions.
This commit is contained in:
parent
d1446ca7a0
commit
c31f3d99f8
|
@ -379,3 +379,17 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories()
|
||||||
|
|
||||||
return orderedAndUniqueIncludes;
|
return orderedAndUniqueIncludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
const char *cmGeneratorTarget::GetCompileDefinitions(const char *config)
|
||||||
|
{
|
||||||
|
if (!config)
|
||||||
|
{
|
||||||
|
return this->Target->GetProperty("COMPILE_DEFINITIONS");
|
||||||
|
}
|
||||||
|
std::string defPropName = "COMPILE_DEFINITIONS_";
|
||||||
|
defPropName +=
|
||||||
|
cmSystemTools::UpperCase(config);
|
||||||
|
|
||||||
|
return this->Target->GetProperty(defPropName.c_str());
|
||||||
|
}
|
||||||
|
|
|
@ -77,6 +77,8 @@ public:
|
||||||
/** Get the include directories for this target. */
|
/** Get the include directories for this target. */
|
||||||
std::vector<std::string> GetIncludeDirectories();
|
std::vector<std::string> GetIncludeDirectories();
|
||||||
|
|
||||||
|
const char *GetCompileDefinitions(const char *config = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClassifySources();
|
void ClassifySources();
|
||||||
void LookupObjectLibraries();
|
void LookupObjectLibraries();
|
||||||
|
|
|
@ -1679,21 +1679,25 @@ void cmLocalVisualStudio6Generator
|
||||||
std::set<std::string> minsizeDefinesSet;
|
std::set<std::string> minsizeDefinesSet;
|
||||||
std::set<std::string> debugrelDefinesSet;
|
std::set<std::string> debugrelDefinesSet;
|
||||||
|
|
||||||
|
|
||||||
|
cmGeneratorTarget* gt =
|
||||||
|
this->GlobalGenerator->GetGeneratorTarget(&target);
|
||||||
|
|
||||||
this->AppendDefines(
|
this->AppendDefines(
|
||||||
definesSet,
|
definesSet,
|
||||||
target.GetProperty("COMPILE_DEFINITIONS"));
|
gt->GetCompileDefinitions());
|
||||||
this->AppendDefines(
|
this->AppendDefines(
|
||||||
debugDefinesSet,
|
debugDefinesSet,
|
||||||
target.GetProperty("COMPILE_DEFINITIONS_DEBUG"));
|
gt->GetCompileDefinitions("DEBUG"));
|
||||||
this->AppendDefines(
|
this->AppendDefines(
|
||||||
releaseDefinesSet,
|
releaseDefinesSet,
|
||||||
target.GetProperty("COMPILE_DEFINITIONS_RELEASE"));
|
gt->GetCompileDefinitions("RELEASE"));
|
||||||
this->AppendDefines(
|
this->AppendDefines(
|
||||||
minsizeDefinesSet,
|
minsizeDefinesSet,
|
||||||
target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"));
|
gt->GetCompileDefinitions("MINSIZEREL"));
|
||||||
this->AppendDefines(
|
this->AppendDefines(
|
||||||
debugrelDefinesSet,
|
debugrelDefinesSet,
|
||||||
target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"));
|
gt->GetCompileDefinitions("RELWITHDEBINFO"));
|
||||||
|
|
||||||
std::string defines = " ";
|
std::string defines = " ";
|
||||||
std::string debugDefines = " ";
|
std::string debugDefines = " ";
|
||||||
|
|
|
@ -302,12 +302,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
|
||||||
|
|
||||||
// Add preprocessor definitions for this target and configuration.
|
// Add preprocessor definitions for this target and configuration.
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Target->GetProperty("COMPILE_DEFINITIONS"));
|
(defines, this->GeneratorTarget->GetCompileDefinitions());
|
||||||
std::string defPropName = "COMPILE_DEFINITIONS_";
|
|
||||||
defPropName +=
|
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
|
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines, this->Target->GetProperty(defPropName.c_str()));
|
(defines, this->GeneratorTarget->GetCompileDefinitions(
|
||||||
|
this->LocalGenerator->ConfigurationName.c_str()));
|
||||||
|
|
||||||
std::string definesString;
|
std::string definesString;
|
||||||
this->LocalGenerator->JoinDefines(defines, definesString, lang);
|
this->LocalGenerator->JoinDefines(defines, definesString, lang);
|
||||||
|
|
|
@ -195,7 +195,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
|
||||||
// Add preprocessor definitions for this target and configuration.
|
// Add preprocessor definitions for this target and configuration.
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines,
|
(defines,
|
||||||
this->Target->GetProperty("COMPILE_DEFINITIONS"));
|
this->GeneratorTarget->GetCompileDefinitions());
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines,
|
(defines,
|
||||||
source->GetProperty("COMPILE_DEFINITIONS"));
|
source->GetProperty("COMPILE_DEFINITIONS"));
|
||||||
|
@ -204,7 +204,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
|
||||||
defPropName += cmSystemTools::UpperCase(this->GetConfigName());
|
defPropName += cmSystemTools::UpperCase(this->GetConfigName());
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines,
|
(defines,
|
||||||
this->Target->GetProperty(defPropName.c_str()));
|
this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName()));
|
||||||
this->LocalGenerator->AppendDefines
|
this->LocalGenerator->AppendDefines
|
||||||
(defines,
|
(defines,
|
||||||
source->GetProperty(defPropName.c_str()));
|
source->GetProperty(defPropName.c_str()));
|
||||||
|
|
Loading…
Reference in New Issue