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

Function HandleTargetsMode

Source/cmInstallCommand.cxx:410–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410bool HandleTargetsMode(std::vector<std::string> const& args,
411 cmExecutionStatus& status)
412{
413 Helper helper(status);
414
415 // This is the TARGETS mode.
416 std::vector<cmTarget*> targets;
417
418 struct ArgVectors
419 {
420 ArgumentParser::MaybeEmpty<std::vector<std::string>> Archive;
421 ArgumentParser::MaybeEmpty<std::vector<std::string>> Library;
422 ArgumentParser::MaybeEmpty<std::vector<std::string>> Runtime;
423 ArgumentParser::MaybeEmpty<std::vector<std::string>> Object;
424 ArgumentParser::MaybeEmpty<std::vector<std::string>> Framework;
425 ArgumentParser::MaybeEmpty<std::vector<std::string>> Bundle;
426 ArgumentParser::MaybeEmpty<std::vector<std::string>> Includes;
427 ArgumentParser::MaybeEmpty<std::vector<std::string>> PrivateHeader;
428 ArgumentParser::MaybeEmpty<std::vector<std::string>> PublicHeader;
429 ArgumentParser::MaybeEmpty<std::vector<std::string>> Resource;
430 ArgumentParser::MaybeEmpty<std::vector<std::string>> CxxModulesBmi;
431 std::vector<std::vector<std::string>> FileSets;
432 };
433
434 static auto const argHelper =
435 cmArgumentParser<ArgVectors>{}
436 .Bind("ARCHIVE"_s, &ArgVectors::Archive)
437 .Bind("LIBRARY"_s, &ArgVectors::Library)
438 .Bind("RUNTIME"_s, &ArgVectors::Runtime)
439 .Bind("OBJECTS"_s, &ArgVectors::Object)
440 .Bind("FRAMEWORK"_s, &ArgVectors::Framework)
441 .Bind("BUNDLE"_s, &ArgVectors::Bundle)
442 .Bind("INCLUDES"_s, &ArgVectors::Includes)
443 .Bind("PRIVATE_HEADER"_s, &ArgVectors::PrivateHeader)
444 .Bind("PUBLIC_HEADER"_s, &ArgVectors::PublicHeader)
445 .Bind("RESOURCE"_s, &ArgVectors::Resource)
446 .Bind("FILE_SET"_s, &ArgVectors::FileSets)
447 .Bind("CXX_MODULES_BMI"_s, &ArgVectors::CxxModulesBmi);
448
449 std::vector<std::string> genericArgVector;
450 ArgVectors const argVectors = argHelper.Parse(args, &genericArgVector);
451
452 // now parse the generic args (i.e. the ones not specialized on LIBRARY/
453 // ARCHIVE, RUNTIME etc. (see above)
454 // These generic args also contain the targets and the export stuff
455 ArgumentParser::MaybeEmpty<std::vector<std::string>> targetList;
456 std::string exports;
457 cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>>
458 runtimeDependenciesArgVector;
459 std::string runtimeDependencySetArg;
460 std::vector<std::string> unknownArgs;
461 cmInstallCommandArguments genericArgs(helper.DefaultComponentName,
462 *helper.Makefile);
463 genericArgs.Bind("TARGETS"_s, targetList);
464 genericArgs.Bind("EXPORT"_s, exports);
465 genericArgs.Bind("RUNTIME_DEPENDENCIES"_s, runtimeDependenciesArgVector);
466 genericArgs.Bind("RUNTIME_DEPENDENCY_SET"_s, runtimeDependencySetArg);
467 genericArgs.Parse(genericArgVector, &unknownArgs);

Callers

nothing calls this directly

Calls 15

moveFunction · 0.85
cmMakeRangeFunction · 0.85
AddBundleExecutableFunction · 0.85
cmNonemptyFunction · 0.85
SetGenericArgumentsMethod · 0.80
GetNamelinkOnlyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…