mirror of
https://github.com/reactos/CMake.git
synced 2024-12-04 09:54:15 +00:00
cmGeneratorTarget: Move Feature API from cmTarget.
This commit is contained in:
parent
50a1bd3df1
commit
ccbc225913
@ -352,6 +352,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)
|
||||
{
|
||||
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -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.
|
||||
|
@ -2813,34 +2813,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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user