MCPcopy Create free account
hub / github.com/Kitware/CMake / cmAddCustomTargetCommand

Function cmAddCustomTargetCommand

Source/cmAddCustomTargetCommand.cxx:21–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include "cmValue.h"
20
21bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
22 cmExecutionStatus& status)
23{
24 if (args.empty()) {
25 status.SetError("called with incorrect number of arguments");
26 return false;
27 }
28
29 cmMakefile& mf = status.GetMakefile();
30 std::string const& targetName = args[0];
31
32 // Check the target name.
33 if (targetName.find_first_of("/\\") != std::string::npos) {
34 status.SetError(cmStrCat("called with invalid target name \"", targetName,
35 "\". Target names may not contain a slash. "
36 "Use ADD_CUSTOM_COMMAND to generate files."));
37 return false;
38 }
39
40 // Accumulate one command line at a time.
41 cmCustomCommandLine currentLine;
42
43 // Save all command lines.
44 cmCustomCommandLines commandLines;
45
46 // Accumulate dependencies.
47 std::vector<std::string> depends;
48 std::vector<std::string> byproducts;
49 std::string working_directory;
50 bool verbatim = false;
51 bool uses_terminal = false;
52 bool command_expand_lists = false;
53 std::string comment_buffer;
54 char const* comment = nullptr;
55 std::vector<std::string> sources;
56 std::string job_pool;
57 std::string job_server_aware;
58
59 // Keep track of parser state.
60 enum tdoing
61 {
62 doing_command,
63 doing_depends,
64 doing_byproducts,
65 doing_working_directory,
66 doing_comment,
67 doing_source,
68 doing_job_pool,
69 doing_job_server_aware,
70 doing_nothing
71 };
72 tdoing doing = doing_command;
73
74 // Look for the ALL option.
75 bool excludeFromAll = true;
76 unsigned int start = 1;
77 if (args.size() > 1) {
78 if (args[1] == "ALL") {

Callers

nothing calls this directly

Calls 15

moveFunction · 0.85
cmIsOnFunction · 0.85
find_first_ofMethod · 0.80
push_backMethod · 0.80
c_strMethod · 0.80
EnforceUniqueNameMethod · 0.80
SetByproductsMethod · 0.80
SetDependsMethod · 0.80
SetCommandLinesMethod · 0.80
SetEscapeOldStyleMethod · 0.80
SetUsesTerminalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…