summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakeCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-21 17:25:13 (GMT)
committerBrad King <brad.king@kitware.com>2020-05-21 17:36:52 (GMT)
commit94c1e4fdb35c01ef5ad57ed3284b20d8d7fc3496 (patch)
treeb2dd5a73b5839d50fa6f5fb0af2c356b69815db5 /Source/cmCMakeCommand.cxx
parent3c5d52579b271e99475873cec953a1ecccbea585 (diff)
downloadCMake-94c1e4fdb35c01ef5ad57ed3284b20d8d7fc3496.zip
CMake-94c1e4fdb35c01ef5ad57ed3284b20d8d7fc3496.tar.gz
CMake-94c1e4fdb35c01ef5ad57ed3284b20d8d7fc3496.tar.bz2
cmake_language: Rename command from cmake_command
Also rename the `INVOKE` signature to `CALL`. Fixes: #20732
Diffstat (limited to 'Source/cmCMakeCommand.cxx')
-rw-r--r--Source/cmCMakeCommand.cxx111
1 files changed, 0 insertions, 111 deletions
diff --git a/Source/cmCMakeCommand.cxx b/Source/cmCMakeCommand.cxx
deleted file mode 100644
index 23bc0ea..0000000
--- a/Source/cmCMakeCommand.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmCMakeCommand.h"
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#include <string>
-
-#include "cmExecutionStatus.h"
-#include "cmListFileCache.h"
-#include "cmMakefile.h"
-#include "cmRange.h"
-#include "cmStringAlgorithms.h"
-
-bool cmCMakeCommand(std::vector<cmListFileArgument> const& args,
- cmExecutionStatus& status)
-{
- if (args.empty()) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- cmMakefile& makefile = status.GetMakefile();
- cmListFileContext context = makefile.GetExecutionContext();
-
- bool result = false;
-
- std::vector<std::string> dispatchExpandedArgs;
- std::vector<cmListFileArgument> dispatchArgs;
- dispatchArgs.emplace_back(args[0]);
- makefile.ExpandArguments(dispatchArgs, dispatchExpandedArgs);
-
- if (dispatchExpandedArgs.empty()) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- if (dispatchExpandedArgs[0] == "INVOKE") {
- if ((args.size() == 1 && dispatchExpandedArgs.size() != 2) ||
- dispatchExpandedArgs.size() > 2) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- // First argument is the name of the function to call
- std::string invokeCommand;
- size_t startArg;
- if (dispatchExpandedArgs.size() == 1) {
- std::vector<std::string> functionExpandedArg;
- std::vector<cmListFileArgument> functionArg;
- functionArg.emplace_back(args[1]);
- makefile.ExpandArguments(functionArg, functionExpandedArg);
-
- if (functionExpandedArg.size() != 1) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- invokeCommand = functionExpandedArg[0];
- startArg = 2;
- } else {
- invokeCommand = dispatchExpandedArgs[1];
- startArg = 1;
- }
-
- cmListFileFunction func;
- func.Name = invokeCommand;
- func.Line = context.Line;
-
- // The rest of the arguments are passed to the function call above
- for (size_t i = startArg; i < args.size(); ++i) {
- cmListFileArgument lfarg;
- lfarg.Delim = args[i].Delim;
- lfarg.Line = context.Line;
- lfarg.Value = args[i].Value;
- func.Arguments.emplace_back(lfarg);
- }
-
- result = makefile.ExecuteCommand(func, status);
- } else if (dispatchExpandedArgs[0] == "EVAL") {
- std::vector<std::string> expandedArgs;
- makefile.ExpandArguments(args, expandedArgs);
-
- if (expandedArgs.size() < 2) {
- status.SetError("called with incorrect number of arguments");
- return false;
- }
-
- if (expandedArgs[1] != "CODE") {
- auto code_iter =
- std::find(expandedArgs.begin() + 2, expandedArgs.end(), "CODE");
- if (code_iter == expandedArgs.end()) {
- status.SetError("called without CODE argument");
- } else {
- status.SetError(
- "called with unsupported arguments between EVAL and CODE arguments");
- }
- return false;
- }
-
- const std::string code =
- cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " ");
- result = makefile.ReadListFileAsString(
- code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL"));
- } else {
- status.SetError("called with unknown meta-operation");
- }
-
- return result;
-}