summaryrefslogtreecommitdiff
path: root/Source/cmCMakeCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCMakeCommand.cxx')
-rw-r--r--Source/cmCMakeCommand.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/cmCMakeCommand.cxx b/Source/cmCMakeCommand.cxx
index 56990864b0..c11a00364c 100644
--- a/Source/cmCMakeCommand.cxx
+++ b/Source/cmCMakeCommand.cxx
@@ -2,11 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCMakeCommand.h"
+#include <algorithm>
#include <cstddef>
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmRange.h"
+#include "cmStringAlgorithms.h"
bool cmCMakeCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -19,6 +22,8 @@ bool cmCMakeCommand(std::vector<std::string> const& args,
cmMakefile& makefile = status.GetMakefile();
cmListFileContext context = makefile.GetExecutionContext();
+ bool result = false;
+
if (args[0] == "INVOKE") {
if (args.size() == 1) {
status.SetError("called with incorrect number of arguments");
@@ -39,9 +44,25 @@ bool cmCMakeCommand(std::vector<std::string> const& args,
func.Arguments.emplace_back(lfarg);
}
- return makefile.ExecuteCommand(func, status);
+ result = makefile.ExecuteCommand(func, status);
+ } else if (args[0] == "EVAL") {
+ if (args.size() < 2) {
+ status.SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ auto code_iter = std::find(args.begin(), args.end(), "CODE");
+ if (code_iter == args.end()) {
+ status.SetError("called without CODE argument");
+ return false;
+ }
+
+ const std::string code = cmJoin(cmMakeRange(++code_iter, args.end()), " ");
+ result = makefile.ReadListFileAsString(
+ code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL"));
+ } else {
+ status.SetError("called with unknown meta-operation");
}
- status.SetError("called with unknown meta-operation");
- return false;
+ return result;
}