summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-06-06 13:40:26 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-06-06 13:44:16 (GMT)
commitccbc2259137fe61a770bb0b5538a20bf5e00bc8f (patch)
tree26a637da257293781f249ac6309133b1fae914d7
parent50a1bd3df13d47167d55fb1584b2c1bc7235884b (diff)
downloadCMake-ccbc2259137fe61a770bb0b5538a20bf5e00bc8f.zip
CMake-ccbc2259137fe61a770bb0b5538a20bf5e00bc8f.tar.gz
CMake-ccbc2259137fe61a770bb0b5538a20bf5e00bc8f.tar.bz2
cmGeneratorTarget: Move Feature API from cmTarget.
-rw-r--r--Source/cmGeneratorTarget.cxx30
-rw-r--r--Source/cmGeneratorTarget.h5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx5
-rw-r--r--Source/cmTarget.cxx28
-rw-r--r--Source/cmTarget.h5
7 files changed, 41 insertions, 39 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e2b8c45..4901820 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -353,6 +353,34 @@ void cmGeneratorTarget::ComputeObjectMapping()
}
//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetFeature(const std::string& feature,
+ const std::string& config) const
+{
+ if(!config.empty())
+ {
+ std::string featureConfig = feature;
+ featureConfig += "_";
+ featureConfig += cmSystemTools::UpperCase(config);
+ if(const char* value = this->Target->GetProperty(featureConfig))
+ {
+ return value;
+ }
+ }
+ if(const char* value = this->Target->GetProperty(feature))
+ {
+ return value;
+ }
+ return this->Makefile->GetFeature(feature, config);
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature,
+ const std::string& config) const
+{
+ return cmSystemTools::IsOn(this->GetFeature(feature, config));
+}
+
+//----------------------------------------------------------------------------
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
{
this->ComputeObjectMapping();
@@ -983,7 +1011,7 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang,
case cmTarget::STATIC_LIBRARY:
{
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
- if(this->Target->GetFeatureAsBool(
+ if(this->GetFeatureAsBool(
"INTERPROCEDURAL_OPTIMIZATION", config))
{
std::string varIPO = var + "_IPO";
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index c79aa72..a8edcb8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -67,6 +67,11 @@ public:
void ComputeObjectMapping();
+ const char* GetFeature(const std::string& feature,
+ const std::string& config) const;
+ bool GetFeatureAsBool(const std::string& feature,
+ const std::string& config) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index a242046..f2d58ec 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -1023,12 +1023,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
{
return activeConfigs;
}
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
const char* propertyValue =
- target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
+ gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
if(cmSystemTools::IsOff(propertyValue))
{
activeConfigs.insert(*i);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9ac9ddb..b2a10a6 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2086,13 +2086,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
//----------------------------------------------------------------------------
const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
{
- return this->Target->GetFeature(feature, this->ConfigName);
+ return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
}
//----------------------------------------------------------------------------
bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
{
- return this->Target->GetFeatureAsBool(feature, this->ConfigName);
+ return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 879d6b7..b2aef68 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -107,13 +107,14 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
{
- return this->Target->GetFeature(feature, this->GetConfigName());
+ return this->GeneratorTarget->GetFeature(feature, this->GetConfigName());
}
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature)
{
- return this->Target->GetFeatureAsBool(feature, this->GetConfigName());
+ return this->GeneratorTarget->GetFeatureAsBool(feature,
+ this->GetConfigName());
}
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4436966..fd732d7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2814,34 +2814,6 @@ void cmTarget::GetTargetVersion(bool soversion,
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetFeature(const std::string& feature,
- const std::string& config) const
-{
- if(!config.empty())
- {
- std::string featureConfig = feature;
- featureConfig += "_";
- featureConfig += cmSystemTools::UpperCase(config);
- if(const char* value = this->GetProperty(featureConfig))
- {
- return value;
- }
- }
- if(const char* value = this->GetProperty(feature))
- {
- return value;
- }
- return this->Makefile->GetFeature(feature, config);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::GetFeatureAsBool(const std::string& feature,
- const std::string& config) const
-{
- return cmSystemTools::IsOn(this->GetFeature(feature, config));
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{
if (this->IsImported())
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0cbb575..f20966a 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -260,11 +260,6 @@ public:
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
- const char* GetFeature(const std::string& feature,
- const std::string& config) const;
- bool GetFeatureAsBool(const std::string& feature,
- const std::string& config) const;
-
bool IsImported() const {return this->IsImportedTarget;}
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;