mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
cmake_language(): Add undocumented GET_EXPERIMENTAL_FEATURE_ENABLED mode
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "cmArgumentParserTypes.h"
|
||||
#include "cmDependencyProvider.h"
|
||||
#include "cmExecutionStatus.h"
|
||||
#include "cmExperimental.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -328,6 +329,46 @@ bool cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL(
|
||||
makefile.AddDefinition(outputVariable, outputValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED(
|
||||
std::vector<cmListFileArgument> const& args, cmExecutionStatus& status)
|
||||
{
|
||||
cmMakefile& makefile = status.GetMakefile();
|
||||
std::vector<std::string> expandedArgs;
|
||||
makefile.ExpandArguments(args, expandedArgs);
|
||||
|
||||
if (expandedArgs.size() != 3) {
|
||||
return FatalError(status,
|
||||
"sub-command GET_EXPERIMENTAL_FEATURE_ENABLED expects "
|
||||
"exactly two arguments");
|
||||
}
|
||||
|
||||
auto const& featureName = expandedArgs[1];
|
||||
auto const& variableName = expandedArgs[2];
|
||||
|
||||
auto feature = cmExperimental::Feature::Sentinel;
|
||||
for (std::size_t i = 0;
|
||||
i < static_cast<std::size_t>(cmExperimental::Feature::Sentinel); i++) {
|
||||
if (cmExperimental::DataForFeature(static_cast<cmExperimental::Feature>(i))
|
||||
.Name == featureName) {
|
||||
feature = static_cast<cmExperimental::Feature>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (feature == cmExperimental::Feature::Sentinel) {
|
||||
return FatalError(status,
|
||||
cmStrCat("Experimental feature name \"", featureName,
|
||||
"\" does not exist."));
|
||||
}
|
||||
|
||||
if (cmExperimental::HasSupportEnabled(makefile, feature)) {
|
||||
makefile.AddDefinition(variableName, "TRUE");
|
||||
} else {
|
||||
makefile.AddDefinition(variableName, "FALSE");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
|
||||
@@ -480,5 +521,10 @@ bool cmCMakeLanguageCommand(std::vector<cmListFileArgument> const& args,
|
||||
return cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL(args, status);
|
||||
}
|
||||
|
||||
if (expArgs[expArg] == "GET_EXPERIMENTAL_FEATURE_ENABLED") {
|
||||
return cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED(args,
|
||||
status);
|
||||
}
|
||||
|
||||
return FatalError(status, "called with unknown meta-operation");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace {
|
||||
*/
|
||||
cmExperimental::FeatureData LookupTable[] = {
|
||||
// CxxModuleCMakeApi
|
||||
{ "bf70d4b0-9fb7-465c-9803-34014e70d112",
|
||||
{ "CxxModuleCMakeApi", "bf70d4b0-9fb7-465c-9803-34014e70d112",
|
||||
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
|
||||
"CMake's C++ module support is experimental. It is meant only for "
|
||||
"experimentation and feedback to CMake developers.",
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
|
||||
struct FeatureData
|
||||
{
|
||||
std::string const Name;
|
||||
std::string const Uuid;
|
||||
std::string const Variable;
|
||||
std::string const Description;
|
||||
|
||||
Reference in New Issue
Block a user