diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-28 15:46:51 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-31 15:07:02 (GMT) |
commit | 70555450fef7432c22735b6e61821e299c3e2ce9 (patch) | |
tree | 3c3f1b9fff329f4468f0222bf5ddd25f1d12a51a /Source/cmTarget.cxx | |
parent | 03b9240d6be072dc67884aa50962454e50f0b8ca (diff) | |
download | CMake-70555450fef7432c22735b6e61821e299c3e2ce9.zip CMake-70555450fef7432c22735b6e61821e299c3e2ce9.tar.gz CMake-70555450fef7432c22735b6e61821e299c3e2ce9.tar.bz2 |
cmTarget: refactor COMPILE_FEATURES usage requirements
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 63860f1..ce333d6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -305,7 +305,6 @@ public: std::map<std::string, BTs<std::string>> LanguageStandardProperties; std::map<cmTargetExport const*, std::vector<std::string>> InstallIncludeDirectoriesEntries; - std::vector<BT<std::string>> CompileFeaturesEntries; std::vector<BT<std::string>> CompileDefinitionsEntries; std::vector<BT<std::string>> PrecompileHeadersEntries; std::vector<BT<std::string>> SourceEntries; @@ -322,6 +321,7 @@ public: UsageRequirementProperty IncludeDirectories; UsageRequirementProperty CompileOptions; + UsageRequirementProperty CompileFeatures; FileSetType HeadersFileSets; FileSetType CxxModulesFileSets; @@ -360,6 +360,7 @@ public: cmTargetInternals::cmTargetInternals() : IncludeDirectories("INCLUDE_DIRECTORIES"_s) , CompileOptions("COMPILE_OPTIONS"_s) + , CompileFeatures("COMPILE_FEATURES"_s) , HeadersFileSets("HEADERS"_s, "HEADER_DIRS"_s, "HEADER_SET"_s, "HEADER_DIRS_"_s, "HEADER_SET_"_s, "Header"_s, "The default header set"_s, "Header set"_s, @@ -977,7 +978,7 @@ void cmTarget::SetLanguageStandardProperty(std::string const& lang, const std::string& feature) { cmListFileBacktrace featureBacktrace; - for (auto const& entry : this->impl->CompileFeaturesEntries) { + for (auto const& entry : this->impl->CompileFeatures.Entries) { if (entry.Value == feature) { featureBacktrace = entry.Backtrace; break; @@ -1469,7 +1470,7 @@ cmBTStringRange cmTarget::GetCompileOptionsEntries() const cmBTStringRange cmTarget::GetCompileFeaturesEntries() const { - return cmMakeRange(this->impl->CompileFeaturesEntries); + return cmMakeRange(this->impl->CompileFeatures.Entries); } cmBTStringRange cmTarget::GetCompileDefinitionsEntries() const @@ -1646,6 +1647,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value) UsageRequirementProperty* usageRequirements[] = { &this->impl->IncludeDirectories, &this->impl->CompileOptions, + &this->impl->CompileFeatures, }; for (auto* usageRequirement : usageRequirements) { @@ -1668,13 +1670,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value) } } - if (prop == propCOMPILE_FEATURES) { - this->impl->CompileFeaturesEntries.clear(); - if (value) { - cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace(); - this->impl->CompileFeaturesEntries.emplace_back(value, lfbt); - } - } else if (prop == propCOMPILE_DEFINITIONS) { + if (prop == propCOMPILE_DEFINITIONS) { this->impl->CompileDefinitionsEntries.clear(); if (value) { cmListFileBacktrace lfbt = this->impl->Makefile->GetBacktrace(); @@ -1838,6 +1834,7 @@ void cmTarget::AppendProperty(const std::string& prop, UsageRequirementProperty* usageRequirements[] = { &this->impl->IncludeDirectories, &this->impl->CompileOptions, + &this->impl->CompileFeatures, }; for (auto* usageRequirement : usageRequirements) { @@ -1860,12 +1857,7 @@ void cmTarget::AppendProperty(const std::string& prop, } } - if (prop == "COMPILE_FEATURES") { - if (!value.empty()) { - cmListFileBacktrace lfbt = this->impl->GetBacktrace(bt); - this->impl->CompileFeaturesEntries.emplace_back(value, lfbt); - } - } else if (prop == "COMPILE_DEFINITIONS") { + if (prop == "COMPILE_DEFINITIONS") { if (!value.empty()) { cmListFileBacktrace lfbt = this->impl->GetBacktrace(bt); this->impl->CompileDefinitionsEntries.emplace_back(value, lfbt); @@ -2347,6 +2339,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const UsageRequirementProperty const* usageRequirements[] = { &this->impl->IncludeDirectories, &this->impl->CompileOptions, + &this->impl->CompileFeatures, }; for (auto const* usageRequirement : usageRequirements) { @@ -2397,15 +2390,6 @@ cmValue cmTarget::GetProperty(const std::string& prop) const if (prop == propTYPE) { return cmValue(cmState::GetTargetTypeName(this->GetType())); } - if (prop == propCOMPILE_FEATURES) { - if (this->impl->CompileFeaturesEntries.empty()) { - return nullptr; - } - - static std::string output; - output = cmJoin(this->impl->CompileFeaturesEntries, ";"); - return cmValue(output); - } if (prop == propCOMPILE_DEFINITIONS) { if (this->impl->CompileDefinitionsEntries.empty()) { return nullptr; |