diff options
author | Brad King <brad.king@kitware.com> | 2023-10-04 17:59:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-10-04 22:15:04 (GMT) |
commit | 7519001ae6cf9da781da465c561870680f3c955d (patch) | |
tree | 9c1d778e3b8e395e686ba494e2d08d46a196aea7 /Source | |
parent | 99fa01d3faa70f1e214acd56ce25002ae310c51d (diff) | |
download | CMake-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.cxx | 17 | ||||
-rw-r--r-- | Source/cmStandardLevelResolver.h | 6 |
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; |