summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2024-02-27 16:53:49 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2024-04-11 14:19:44 (GMT)
commit7aa1e45e568783e89f7266ff9b8d6f3c538a560b (patch)
tree1be66b141d4908bc12cf30ae8de15f333c23e2a9
parent7146cf92486a56014f858d6fe6032fbe1453fb7f (diff)
downloadCMake-7aa1e45e568783e89f7266ff9b8d6f3c538a560b.zip
CMake-7aa1e45e568783e89f7266ff9b8d6f3c538a560b.tar.gz
CMake-7aa1e45e568783e89f7266ff9b8d6f3c538a560b.tar.bz2
cmStandardLevelResolver: offer an API to get the string of a level
-rw-r--r--Source/cmStandardLevelResolver.cxx15
-rw-r--r--Source/cmStandardLevelResolver.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index c9ed380..44c4ae1 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -541,6 +541,21 @@ std::string cmStandardLevelResolver::GetEffectiveStandard(
return mapping->second.GetEffectiveStandard(this->Makefile, target, config);
}
+std::string cmStandardLevelResolver::GetLevelString(
+ std::string const& lang, cmStandardLevel const& level) const
+{
+ auto mapping = StandardComputerMapping.find(lang);
+ if (mapping == StandardComputerMapping.end()) {
+ return {};
+ }
+
+ if (mapping->second.LevelsAsStrings.size() <= level.Index()) {
+ return {};
+ }
+
+ return mapping->second.LevelsAsStrings[level.Index()];
+}
+
bool cmStandardLevelResolver::AddRequiredTargetFeature(
cmTarget* target, const std::string& feature, std::string* error) const
{
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 29cab55..523aa73 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -29,6 +29,9 @@ public:
std::string const& lang,
std::string const& config) const;
+ std::string GetLevelString(std::string const& lang,
+ cmStandardLevel const& level) const;
+
bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
std::string* error = nullptr) const;