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

Function HandleScriptMode

Source/cmInstallCommand.cxx:315–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315bool HandleScriptMode(std::vector<std::string> const& args,
316 cmExecutionStatus& status)
317{
318 Helper helper(status);
319
320 std::string component = helper.DefaultComponentName;
321 int componentCount = 0;
322 bool doing_script = false;
323 bool doing_code = false;
324 bool exclude_from_all = false;
325 bool all_components = false;
326
327 // Scan the args once for COMPONENT. Only allow one.
328 //
329 for (size_t i = 0; i < args.size(); ++i) {
330 if (args[i] == "COMPONENT" && i + 1 < args.size()) {
331 ++componentCount;
332 ++i;
333 component = args[i];
334 }
335 if (args[i] == "EXCLUDE_FROM_ALL") {
336 exclude_from_all = true;
337 } else if (args[i] == "ALL_COMPONENTS") {
338 all_components = true;
339 }
340 }
341
342 if (componentCount > 1) {
343 status.SetError("given more than one COMPONENT for the SCRIPT or CODE "
344 "signature of the INSTALL command. "
345 "Use multiple INSTALL commands with one COMPONENT each.");
346 return false;
347 }
348
349 if (all_components && componentCount == 1) {
350 status.SetError("ALL_COMPONENTS and COMPONENT are mutually exclusive");
351 return false;
352 }
353
354 // Scan the args again, this time adding install generators each time we
355 // encounter a SCRIPT or CODE arg:
356 //
357 for (std::string const& arg : args) {
358 if (arg == "SCRIPT") {
359 doing_script = true;
360 doing_code = false;
361 } else if (arg == "CODE") {
362 doing_script = false;
363 doing_code = true;
364 } else if (arg == "COMPONENT") {
365 doing_script = false;
366 doing_code = false;
367 } else if (doing_script) {
368 doing_script = false;
369 std::string script = arg;
370 if (!cmHasLiteralPrefix(script, "$<INSTALL_PREFIX>")) {
371 if (!cmSystemTools::FileIsFullPath(script)) {
372 script =

Callers

nothing calls this directly

Calls 8

cmHasLiteralPrefixFunction · 0.85
AddInstallComponentMethod · 0.80
cmStrCatFunction · 0.70
sizeMethod · 0.45
SetErrorMethod · 0.45
AddInstallGeneratorMethod · 0.45
GetBacktraceMethod · 0.45
GetGlobalGeneratorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…