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

Function cmSetTargetPropertiesCommand

Source/cmSetTargetPropertiesCommand.cxx:13–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "cmTarget.h"
12
13bool cmSetTargetPropertiesCommand(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 // first identify the properties arguments
22 auto propsIter = std::find(args.begin(), args.end(), "PROPERTIES");
23 if (propsIter == args.end() || propsIter + 1 == args.end()) {
24 status.SetError("called with illegal arguments, maybe missing a "
25 "PROPERTIES specifier?");
26 return false;
27 }
28
29 if (std::distance(propsIter, args.end()) % 2 != 1) {
30 status.SetError("called with incorrect number of arguments.");
31 return false;
32 }
33
34 cmMakefile& mf = status.GetMakefile();
35
36 // loop over all the targets
37 for (std::string const& tname : cmStringRange{ args.begin(), propsIter }) {
38 if (mf.IsAlias(tname)) {
39 status.SetError("can not be used on an ALIAS target.");
40 return false;
41 }
42 if (cmTarget* target = mf.FindTargetToUse(tname)) {
43 if (target->IsSymbolic()) {
44 status.SetError("can not be used on a SYMBOLIC target.");
45 return false;
46 }
47 // loop through all the props and set them
48 for (auto k = propsIter + 1; k != args.end(); k += 2) {
49 target->SetProperty(*k, *(k + 1));
50 target->CheckProperty(*k, &mf);
51 }
52 } else {
53 status.SetError(
54 cmStrCat("Can not find target to add properties to: ", tname));
55 return false;
56 }
57 }
58 return true;
59}

Callers

nothing calls this directly

Calls 12

FindTargetToUseMethod · 0.80
CheckPropertyMethod · 0.80
cmStrCatFunction · 0.70
findFunction · 0.50
sizeMethod · 0.45
SetErrorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetMakefileMethod · 0.45
IsAliasMethod · 0.45
IsSymbolicMethod · 0.45
SetPropertyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…