cmExperimental: add support for getting a feature value from its name

This commit is contained in:
Ben Boeckel
2024-04-09 20:05:19 -04:00
parent 24f1e7c524
commit e8582abc6d
2 changed files with 17 additions and 0 deletions

View File

@@ -54,6 +54,20 @@ const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f)
return ::DataForFeature(f);
}
cm::optional<cmExperimental::Feature> cmExperimental::FeatureByName(
std::string const& name)
{
size_t idx = 0;
for (auto const& feature : LookupTable) {
if (feature.Name == name) {
return static_cast<Feature>(idx);
}
++idx;
}
return {};
}
bool cmExperimental::HasSupportEnabled(cmMakefile const& mf, Feature f)
{
bool enabled = false;

View File

@@ -8,6 +8,8 @@
#include <string>
#include <vector>
#include <cm/optional>
class cmMakefile;
class cmExperimental
@@ -40,5 +42,6 @@ public:
};
static const FeatureData& DataForFeature(Feature f);
static cm::optional<Feature> FeatureByName(std::string const& name);
static bool HasSupportEnabled(cmMakefile const& mf, Feature f);
};