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