mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
cmExperimental: Expose feature data API
This commit is contained in:
@@ -18,14 +18,7 @@ namespace {
|
||||
* Search for other instances to keep the documentation and test suite
|
||||
* up-to-date.
|
||||
*/
|
||||
|
||||
struct FeatureData
|
||||
{
|
||||
std::string const Uuid;
|
||||
std::string const Variable;
|
||||
std::string const Description;
|
||||
bool Warned;
|
||||
} LookupTable[] = {
|
||||
cmExperimental::FeatureData LookupTable[] = {
|
||||
// CxxModuleCMakeApi
|
||||
{ "bf70d4b0-9fb7-465c-9803-34014e70d112",
|
||||
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
|
||||
@@ -37,17 +30,22 @@ static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
|
||||
static_cast<size_t>(cmExperimental::Feature::Sentinel),
|
||||
"Experimental feature lookup table mismatch");
|
||||
|
||||
FeatureData& DataForFeature(cmExperimental::Feature f)
|
||||
cmExperimental::FeatureData& DataForFeature(cmExperimental::Feature f)
|
||||
{
|
||||
assert(f != cmExperimental::Feature::Sentinel);
|
||||
return LookupTable[static_cast<size_t>(f)];
|
||||
}
|
||||
}
|
||||
|
||||
const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f)
|
||||
{
|
||||
return ::DataForFeature(f);
|
||||
}
|
||||
|
||||
bool cmExperimental::HasSupportEnabled(cmMakefile const& mf, Feature f)
|
||||
{
|
||||
bool enabled = false;
|
||||
auto& data = DataForFeature(f);
|
||||
auto& data = ::DataForFeature(f);
|
||||
|
||||
auto value = mf.GetDefinition(data.Variable);
|
||||
if (value == data.Uuid) {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <string>
|
||||
|
||||
class cmMakefile;
|
||||
|
||||
class cmExperimental
|
||||
@@ -17,5 +19,14 @@ public:
|
||||
Sentinel,
|
||||
};
|
||||
|
||||
struct FeatureData
|
||||
{
|
||||
std::string const Uuid;
|
||||
std::string const Variable;
|
||||
std::string const Description;
|
||||
bool Warned;
|
||||
};
|
||||
|
||||
static const FeatureData& DataForFeature(Feature f);
|
||||
static bool HasSupportEnabled(cmMakefile const& mf, Feature f);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user