mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-12 17:19:05 -05:00
cmStandardLevelResolver: Add method to get feature standard level
This commit is contained in:
@@ -349,7 +349,7 @@ struct StandardLevelComputer
|
|||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<cmStandardLevel> needed =
|
cm::optional<cmStandardLevel> needed =
|
||||||
this->HighestStandardNeeded(makefile, feature);
|
this->CompileFeatureStandardLevel(makefile, feature);
|
||||||
|
|
||||||
cmValue existingStandard = currentLangStandardValue;
|
cmValue existingStandard = currentLangStandardValue;
|
||||||
if (!existingStandard) {
|
if (!existingStandard) {
|
||||||
@@ -437,13 +437,13 @@ struct StandardLevelComputer
|
|||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<cmStandardLevel> needed =
|
cm::optional<cmStandardLevel> needed =
|
||||||
this->HighestStandardNeeded(makefile, feature);
|
this->CompileFeatureStandardLevel(makefile, feature);
|
||||||
|
|
||||||
return !needed ||
|
return !needed ||
|
||||||
(this->Levels.begin() + needed->Index()) <= existingLevelIter;
|
(this->Levels.begin() + needed->Index()) <= existingLevelIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
cm::optional<cmStandardLevel> HighestStandardNeeded(
|
cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
|
||||||
cmMakefile* makefile, std::string const& feature) const
|
cmMakefile* makefile, std::string const& feature) const
|
||||||
{
|
{
|
||||||
std::string prefix = cmStrCat("CMAKE_", this->Language);
|
std::string prefix = cmStrCat("CMAKE_", this->Language);
|
||||||
@@ -652,6 +652,17 @@ bool cmStandardLevelResolver::CompileFeatureKnown(
|
|||||||
return false;
|
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(
|
cmValue cmStandardLevelResolver::CompileFeaturesAvailable(
|
||||||
const std::string& lang, std::string* error) const
|
const std::string& lang, std::string* error) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <cm/optional>
|
||||||
|
|
||||||
#include "cmValue.h"
|
#include "cmValue.h"
|
||||||
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmGeneratorTarget;
|
class cmGeneratorTarget;
|
||||||
|
class cmStandardLevel;
|
||||||
class cmTarget;
|
class cmTarget;
|
||||||
|
|
||||||
class cmStandardLevelResolver
|
class cmStandardLevelResolver
|
||||||
@@ -33,6 +36,9 @@ public:
|
|||||||
const std::string& feature, std::string& lang,
|
const std::string& feature, std::string& lang,
|
||||||
std::string* error) const;
|
std::string* error) const;
|
||||||
|
|
||||||
|
cm::optional<cmStandardLevel> CompileFeatureStandardLevel(
|
||||||
|
std::string const& lang, std::string const& feature) const;
|
||||||
|
|
||||||
cmValue CompileFeaturesAvailable(const std::string& lang,
|
cmValue CompileFeaturesAvailable(const std::string& lang,
|
||||||
std::string* error) const;
|
std::string* error) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user