mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
cmExperimental: add support for getting a feature value from its name
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user