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

Function MainSignature

Source/cmBuildCommand.cxx:16–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace {
15
16bool MainSignature(std::vector<std::string> const& args,
17 cmExecutionStatus& status)
18{
19 if (args.empty()) {
20 status.SetError("requires at least one argument naming a CMake variable");
21 return false;
22 }
23
24 // The cmake variable in which to store the result.
25 std::string const& variable = args[0];
26
27 // Parse remaining arguments.
28 std::string configuration;
29 std::string project_name;
30 std::string target;
31 std::string parallel;
32 enum Doing
33 {
34 DoingNone,
35 DoingConfiguration,
36 DoingProjectName,
37 DoingTarget,
38 DoingParallel
39 };
40 Doing doing = DoingNone;
41 for (unsigned int i = 1; i < args.size(); ++i) {
42 if (args[i] == "CONFIGURATION") {
43 doing = DoingConfiguration;
44 } else if (args[i] == "PROJECT_NAME") {
45 doing = DoingProjectName;
46 } else if (args[i] == "TARGET") {
47 doing = DoingTarget;
48 } else if (args[i] == "PARALLEL_LEVEL") {
49 doing = DoingParallel;
50 } else if (doing == DoingConfiguration) {
51 doing = DoingNone;
52 configuration = args[i];
53 } else if (doing == DoingProjectName) {
54 doing = DoingNone;
55 project_name = args[i];
56 } else if (doing == DoingTarget) {
57 doing = DoingNone;
58 target = args[i];
59 } else if (doing == DoingParallel) {
60 doing = DoingNone;
61 parallel = args[i];
62 } else {
63 status.SetError(cmStrCat("unknown argument \"", args[i], '"'));
64 return false;
65 }
66 }
67
68 // If null/empty CONFIGURATION argument, cmake --build uses 'Debug'
69 // in the currently implemented multi-configuration global generators...
70 // so we put this code here to end up with the same default configuration
71 // as the original 2-arg build_command signature:
72 //
73 if (configuration.empty()) {

Callers 1

cmBuildCommandFunction · 0.85

Calls 9

cmStrCatFunction · 0.70
emptyMethod · 0.45
SetErrorMethod · 0.45
sizeMethod · 0.45
GetMakefileMethod · 0.45
IssueMessageMethod · 0.45
GetGlobalGeneratorMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…