| 83 | } |
| 84 | |
| 85 | std::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 | |
| 130 | void cmExportTryCompileFileGenerator::PopulateProperties( |
| 131 | cmGeneratorTarget const* target, ImportPropertyMap& properties, |
no test coverage detected