summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-09-17 17:56:50 (GMT)
committerStephen Kelly <steveire@gmail.com>2012-09-19 13:32:19 (GMT)
commitc31f3d99f8adc95c355f8607bdfccf01cc37c51d (patch)
treeb7eadc1c88e22a045c42bd66b51a15c486559ba6 /Source
parentd1446ca7a0d1de4ede995d64deef057c741ef0c2 (diff)
downloadCMake-c31f3d99f8adc95c355f8607bdfccf01cc37c51d.zip
CMake-c31f3d99f8adc95c355f8607bdfccf01cc37c51d.tar.gz
CMake-c31f3d99f8adc95c355f8607bdfccf01cc37c51d.tar.bz2
Add a wrapper for accessing config-specific compile-definitions.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx14
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.cxx9
-rw-r--r--Source/cmNinjaTargetGenerator.cxx4
5 files changed, 31 insertions, 12 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 044d8ee..db88834 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -379,3 +379,17 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories()
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());
+}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6a0fe0f..060e25a 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -77,6 +77,8 @@ public:
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories();
+ const char *GetCompileDefinitions(const char *config = 0);
+
private:
void ClassifySources();
void LookupObjectLibraries();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index adacd3b..72b56e7 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1679,21 +1679,25 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
+
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
this->AppendDefines(
definesSet,
- target.GetProperty("COMPILE_DEFINITIONS"));
+ gt->GetCompileDefinitions());
this->AppendDefines(
debugDefinesSet,
- target.GetProperty("COMPILE_DEFINITIONS_DEBUG"));
+ gt->GetCompileDefinitions("DEBUG"));
this->AppendDefines(
releaseDefinesSet,
- target.GetProperty("COMPILE_DEFINITIONS_RELEASE"));
+ gt->GetCompileDefinitions("RELEASE"));
this->AppendDefines(
minsizeDefinesSet,
- target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"));
+ gt->GetCompileDefinitions("MINSIZEREL"));
this->AppendDefines(
debugrelDefinesSet,
- target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"));
+ gt->GetCompileDefinitions("RELWITHDEBINFO"));
std::string defines = " ";
std::string debugDefines = " ";
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index cde3299..9560c10 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -302,12 +302,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
// Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AppendDefines
- (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"));
- std::string defPropName = "COMPILE_DEFINITIONS_";
- defPropName +=
- cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
+ (defines, this->GeneratorTarget->GetCompileDefinitions());
+
this->LocalGenerator->AppendDefines
- (defines, this->Target->GetProperty(defPropName.c_str()));
+ (defines, this->GeneratorTarget->GetCompileDefinitions(
+ this->LocalGenerator->ConfigurationName.c_str()));
std::string definesString;
this->LocalGenerator->JoinDefines(defines, definesString, lang);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index d4ab133..1d11aca 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -195,7 +195,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
// Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AppendDefines
(defines,
- this->Target->GetProperty("COMPILE_DEFINITIONS"));
+ this->GeneratorTarget->GetCompileDefinitions());
this->LocalGenerator->AppendDefines
(defines,
source->GetProperty("COMPILE_DEFINITIONS"));
@@ -204,7 +204,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
defPropName += cmSystemTools::UpperCase(this->GetConfigName());
this->LocalGenerator->AppendDefines
(defines,
- this->Target->GetProperty(defPropName.c_str()));
+ this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName()));
this->LocalGenerator->AppendDefines
(defines,
source->GetProperty(defPropName.c_str()));