mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
cmStandardLevelResolver: Add method to get feature standard level
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user