summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-10-04 17:59:10 (GMT)
committerBrad King <brad.king@kitware.com>2023-10-04 22:15:04 (GMT)
commit7519001ae6cf9da781da465c561870680f3c955d (patch)
tree9c1d778e3b8e395e686ba494e2d08d46a196aea7 /Source
parent99fa01d3faa70f1e214acd56ce25002ae310c51d (diff)
downloadCMake-7519001ae6cf9da781da465c561870680f3c955d.zip
CMake-7519001ae6cf9da781da465c561870680f3c955d.tar.gz
CMake-7519001ae6cf9da781da465c561870680f3c955d.tar.bz2
cmStandardLevelResolver: Add method to get feature standard level
Diffstat (limited to 'Source')
-rw-r--r--Source/cmStandardLevelResolver.cxx17
-rw-r--r--Source/cmStandardLevelResolver.h6
2 files changed, 20 insertions, 3 deletions
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 41dd316..a24d480 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -349,7 +349,7 @@ struct StandardLevelComputer
}
cm::optional<cmStandardLevel> needed =
- this->HighestStandardNeeded(makefile, feature);
+ this->CompileFeatureStandardLevel(makefile, feature);
cmValue existingStandard = currentLangStandardValue;
if (!existingStandard) {
@@ -437,13 +437,13 @@ struct StandardLevelComputer
}
cm::optional<cmStandardLevel> needed =
- this->HighestStandardNeeded(makefile, feature);
+ this->CompileFeatureStandardLevel(makefile, feature);
return !needed ||
(this->Levels.begin() + needed->Index()) <= existingLevelIter;
}
- cm::optional<cmStandardLevel> HighestStandardNeeded(
+ cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
cmMakefile* makefile, std::string const& feature) const
{
std::string prefix = cmStrCat("CMAKE_", this->Language);
@@ -652,6 +652,17 @@ bool cmStandardLevelResolver::CompileFeatureKnown(
return false;
}
+cm::optional<cmStandardLevel>
+cmStandardLevelResolver::CompileFeatureStandardLevel(
+ std::string const& lang, std::string const& feature) const
+{
+ auto mapping = StandardComputerMapping.find(lang);
+ if (mapping == cm::cend(StandardComputerMapping)) {
+ return cm::nullopt;
+ }
+ return mapping->second.CompileFeatureStandardLevel(this->Makefile, feature);
+}
+
cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
const std::string& lang, std::string* error) const
{
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 03adf3f..2dd978c 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -4,10 +4,13 @@
#include <string>
+#include <cm/optional>
+
#include "cmValue.h"
class cmMakefile;
class cmGeneratorTarget;
+class cmStandardLevel;
class cmTarget;
class cmStandardLevelResolver
@@ -33,6 +36,9 @@ public:
const std::string& feature, std::string& lang,
std::string* error) const;
+ cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
+ std::string const& lang, std::string const& feature) const;
+
cmValue CompileFeaturesAvailable(const std::string& lang,
std::string* error) const;