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

Method FindTargets

Source/cmExportTryCompileFileGenerator.cxx:85–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85std::string cmExportTryCompileFileGenerator::FindTargets(
86 std::string const& propName, cmGeneratorTarget const* tgt,
87 std::string const& language, std::set<cmGeneratorTarget const*>& emitted)
88{
89 cmValue prop = tgt->GetProperty(propName);
90 if (!prop) {
91 return std::string();
92 }
93
94 cm::GenEx::Context context(tgt->LocalGenerator, this->Config, language);
95
96 cmGeneratorExpression ge(*tgt->Makefile->GetCMakeInstance());
97
98 std::unique_ptr<cmGeneratorExpressionDAGChecker> parentDagChecker;
99 if (propName == "INTERFACE_LINK_OPTIONS") {
100 // To please constraint checks of DAGChecker, this property must have
101 // LINK_OPTIONS property as parent
102 parentDagChecker = cm::make_unique<cmGeneratorExpressionDAGChecker>(
103 tgt, "LINK_OPTIONS", nullptr, nullptr, context);
104 }
105 cmGeneratorExpressionDAGChecker dagChecker{
106 tgt, propName, nullptr, parentDagChecker.get(), context,
107 };
108
109 std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
110
111 cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
112 cmTarget::Visibility::Normal, tgt->Target->GetMakefile(),
113 cmTarget::PerConfig::Yes);
114 dummyHead.SetIsForTryCompile();
115
116 cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
117
118 std::string result = cge->Evaluate(context, &dagChecker, &gDummyHead, tgt);
119
120 std::set<cmGeneratorTarget const*> const& allTargets =
121 cge->GetAllTargetsSeen();
122 for (cmGeneratorTarget const* target : allTargets) {
123 if (emitted.insert(target).second) {
124 this->Exports.push_back(target);
125 }
126 }
127 return result;
128}
129
130void cmExportTryCompileFileGenerator::PopulateProperties(
131 cmGeneratorTarget const* target, ImportPropertyMap& properties,

Callers 2

GenerateMainFileMethod · 0.95
PopulatePropertiesMethod · 0.95

Calls 10

SetIsForTryCompileMethod · 0.80
push_backMethod · 0.80
GetPropertyMethod · 0.45
GetCMakeInstanceMethod · 0.45
getMethod · 0.45
ParseMethod · 0.45
GetMakefileMethod · 0.45
GetLocalGeneratorMethod · 0.45
EvaluateMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected