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

Method DetectBaseLinkerCommand

Source/cmFastbuildNormalTargetGenerator.cxx:202–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202bool cmFastbuildNormalTargetGenerator::DetectBaseLinkerCommand(
203 std::string& command, std::string const& arch,
204 cmGeneratorTarget::Names const& targetNames)
205{
206 std::string const linkLanguage =
207 this->GeneratorTarget->GetLinkerLanguage(Config);
208 if (linkLanguage.empty()) {
209 cmSystemTools::Error("CMake can not determine linker language for "
210 "target: " +
211 this->GeneratorTarget->GetName());
212 return false;
213 }
214 LogMessage("linkLanguage: " + linkLanguage);
215
216 std::string linkLibs;
217 std::string targetFlags;
218 std::string linkFlags;
219 std::string frameworkPath;
220 // Tested in "RunCMake.StandardLinkDirectories" test.
221 std::string linkPath;
222
223 std::unique_ptr<cmLinkLineComputer> const linkLineComputer =
224 this->GetGlobalGenerator()->CreateLinkLineComputer(
225 this->LocalGenerator,
226 this->GetLocalGenerator()->GetStateSnapshot().GetDirectory());
227
228 this->LocalCommonGenerator->GetTargetFlags(
229 linkLineComputer.get(), Config, linkLibs, targetFlags, linkFlags,
230 frameworkPath, linkPath, this->GeneratorTarget);
231
232 // cmLocalGenerator::GetStaticLibraryFlags seems to add empty quotes when
233 // appending "STATIC_LIBRARY_FLAGS_DEBUG"...
234 cmSystemTools::ReplaceString(linkFlags, "\"\"", "");
235 LogMessage("linkLibs: " + linkLibs);
236 LogMessage("targetFlags: " + targetFlags);
237 LogMessage("linkFlags: " + linkFlags);
238 LogMessage("frameworkPath: " + frameworkPath);
239 LogMessage("linkPath: " + linkPath);
240
241 LogMessage("MANIFESTS: " + this->GetManifests(Config));
242
243 cmComputeLinkInformation* linkInfo =
244 this->GeneratorTarget->GetLinkInformation(Config);
245 if (!linkInfo) {
246 return false;
247 }
248
249 // Tested in "RunCMake.RuntimePath" test.
250 std::string const rpath = linkLineComputer->ComputeRPath(*linkInfo);
251 LogMessage("RPath: " + rpath);
252
253 if (!linkFlags.empty()) {
254 linkFlags += " ";
255 }
256 linkFlags += cmJoin({ rpath, frameworkPath, linkPath }, " ");
257
258 cmStateEnums::TargetType const targetType = this->GeneratorTarget->GetType();
259 // Add OS X version flags, if any.

Callers

nothing calls this directly

Calls 15

moveFunction · 0.85
GetTargetFlagsMethod · 0.80
GetLinkInformationMethod · 0.80
ComputeRPathMethod · 0.80
AppendOSXVerFlagMethod · 0.80
AddArchitectureFlagsMethod · 0.80
AppendLWYUFlagsMethod · 0.80
c_strMethod · 0.80
HasSONameMethod · 0.80
GetSONameFlagMethod · 0.80
GetTargetVersionMethod · 0.80

Tested by

no test coverage detected