From 7519001ae6cf9da781da465c561870680f3c955d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Oct 2023 13:59:10 -0400 Subject: cmStandardLevelResolver: Add method to get feature standard level --- Source/cmStandardLevelResolver.cxx | 17 ++++++++++++++--- 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 needed = - this->HighestStandardNeeded(makefile, feature); + this->CompileFeatureStandardLevel(makefile, feature); cmValue existingStandard = currentLangStandardValue; if (!existingStandard) { @@ -437,13 +437,13 @@ struct StandardLevelComputer } cm::optional needed = - this->HighestStandardNeeded(makefile, feature); + this->CompileFeatureStandardLevel(makefile, feature); return !needed || (this->Levels.begin() + needed->Index()) <= existingLevelIter; } - cm::optional HighestStandardNeeded( + cm::optional 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 +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 +#include + #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 CompileFeatureStandardLevel( + std::string const& lang, std::string const& feature) const; + cmValue CompileFeaturesAvailable(const std::string& lang, std::string* error) const; -- cgit v0.12