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

Method GetLocation

Source/cmTargetPropertyComputer.h:44–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43 template <typename Target>
44 static cmValue GetLocation(Target const* tgt, std::string const& prop,
45 cmMakefile const& mf)
46
47 {
48 // Watch for special "computed" properties that are dependent on
49 // other properties or variables. Always recompute them.
50 if (tgt->GetType() == cmStateEnums::EXECUTABLE ||
51 tgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
52 tgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
53 tgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
54 tgt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
55 static std::string const propLOCATION = "LOCATION";
56 if (prop == propLOCATION) {
57 if (!tgt->IsImported()) {
58 IssueLocationPropertyError(tgt->GetName(), mf);
59 return nullptr;
60 }
61 return cmValue(ImportedLocation(tgt, std::string()));
62 }
63
64 // Support "LOCATION_<CONFIG>".
65 if (cmHasLiteralPrefix(prop, "LOCATION_")) {
66 if (!tgt->IsImported()) {
67 IssueLocationPropertyError(tgt->GetName(), mf);
68 return nullptr;
69 }
70 std::string configName = prop.substr(9);
71 return cmValue(ImportedLocation(tgt, configName));
72 }
73
74 // Support "<CONFIG>_LOCATION".
75 if (cmHasLiteralSuffix(prop, "_LOCATION") &&
76 !cmHasLiteralPrefix(prop, "XCODE_ATTRIBUTE_")) {
77 std::string configName(prop.c_str(), prop.size() - 9);
78 if (configName != "IMPORTED") {
79 if (!tgt->IsImported()) {
80 IssueLocationPropertyError(tgt->GetName(), mf);
81 return nullptr;
82 }
83 return cmValue(ImportedLocation(tgt, configName));
84 }
85 }
86 }
87 return nullptr;
88 }
89
90 template <typename Target>
91 static cmValue GetSources(Target const* tgt);

Callers

nothing calls this directly

Calls 9

cmHasLiteralPrefixFunction · 0.85
cmHasLiteralSuffixFunction · 0.85
c_strMethod · 0.80
cmValueClass · 0.70
GetTypeMethod · 0.45
IsImportedMethod · 0.45
GetNameMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected