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

Function cmInstallTargetsCommand

Source/cmInstallTargetsCommand.cxx:13–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "cmTarget.h"
12
13bool cmInstallTargetsCommand(std::vector<std::string> const& args,
14 cmExecutionStatus& status)
15{
16 if (args.size() < 2) {
17 status.SetError("called with incorrect number of arguments");
18 return false;
19 }
20
21 cmMakefile& mf = status.GetMakefile();
22
23 // Enable the install target.
24 mf.GetGlobalGenerator()->EnableInstallTarget();
25
26 cmMakefile::cmTargetMap& tgts = mf.GetTargets();
27 auto s = args.begin();
28 ++s;
29 std::string runtime_dir = "/bin";
30 for (; s != args.end(); ++s) {
31 if (*s == "RUNTIME_DIRECTORY") {
32 ++s;
33 if (s == args.end()) {
34 status.SetError("called with RUNTIME_DIRECTORY but no actual "
35 "directory");
36 return false;
37 }
38
39 runtime_dir = *s;
40 } else {
41 auto ti = tgts.find(*s);
42 if (ti != tgts.end()) {
43 ti->second.SetInstallPath(args[0]);
44 ti->second.SetRuntimeInstallPath(runtime_dir);
45 ti->second.SetHaveInstallRule(true);
46 } else {
47 std::string str = "Cannot find target: \"" + *s + "\" to install.";
48 status.SetError(str);
49 return false;
50 }
51 }
52 }
53
54 mf.GetGlobalGenerator()->AddInstallComponent(
55 mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
56
57 return true;
58}

Callers

nothing calls this directly

Calls 13

EnableInstallTargetMethod · 0.80
GetTargetsMethod · 0.80
SetInstallPathMethod · 0.80
SetRuntimeInstallPathMethod · 0.80
SetHaveInstallRuleMethod · 0.80
AddInstallComponentMethod · 0.80
sizeMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
GetGlobalGeneratorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…