|
@@ -17,6 +17,7 @@
|
|
|
#include "cmArgumentParserTypes.h"
|
|
#include "cmArgumentParserTypes.h"
|
|
|
#include "cmDependencyProvider.h"
|
|
#include "cmDependencyProvider.h"
|
|
|
#include "cmExecutionStatus.h"
|
|
#include "cmExecutionStatus.h"
|
|
|
|
|
+#include "cmExperimental.h"
|
|
|
#include "cmGlobalGenerator.h"
|
|
#include "cmGlobalGenerator.h"
|
|
|
#include "cmListFileCache.h"
|
|
#include "cmListFileCache.h"
|
|
|
#include "cmMakefile.h"
|
|
#include "cmMakefile.h"
|
|
@@ -328,6 +329,46 @@ bool cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL(
|
|
|
makefile.AddDefinition(outputVariable, outputValue);
|
|
makefile.AddDefinition(outputVariable, outputValue);
|
|
|
return true;
|
|
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,
|
|
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);
|
|
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");
|
|
return FatalError(status, "called with unknown meta-operation");
|
|
|
}
|
|
}
|