| 453 | } |
| 454 | |
| 455 | void cmMakefileLibraryTargetGenerator::WriteLibraryRules( |
| 456 | std::string const& linkRuleVar, std::string const& extraFlags, bool relink) |
| 457 | { |
| 458 | // TODO: Merge the methods that call this method to avoid |
| 459 | // code duplication. |
| 460 | std::vector<std::string> commands; |
| 461 | |
| 462 | // Get the language to use for linking this library. |
| 463 | std::string linkLanguage = |
| 464 | this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName()); |
| 465 | |
| 466 | // Make sure we have a link language. |
| 467 | if (linkLanguage.empty()) { |
| 468 | cmSystemTools::Error("Cannot determine link language for target \"" + |
| 469 | this->GeneratorTarget->GetName() + "\"."); |
| 470 | return; |
| 471 | } |
| 472 | |
| 473 | auto linker = this->GeneratorTarget->GetLinkerTool(this->GetConfigName()); |
| 474 | |
| 475 | // Build list of dependencies. |
| 476 | std::vector<std::string> depends; |
| 477 | this->AppendLinkDepends(depends, linkLanguage); |
| 478 | if (!this->DeviceLinkObject.empty()) { |
| 479 | depends.push_back(this->DeviceLinkObject); |
| 480 | } |
| 481 | |
| 482 | // Create set of linking flags. |
| 483 | std::string linkFlags; |
| 484 | this->LocalGenerator->AppendFlags(linkFlags, extraFlags); |
| 485 | this->LocalGenerator->AppendIPOLinkerFlags( |
| 486 | linkFlags, this->GeneratorTarget, this->GetConfigName(), linkLanguage); |
| 487 | |
| 488 | // Add OSX version flags, if any. |
| 489 | if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || |
| 490 | this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { |
| 491 | this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true); |
| 492 | this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false); |
| 493 | } |
| 494 | |
| 495 | // Construct the name of the library. |
| 496 | this->GeneratorTarget->GetLibraryNames(this->GetConfigName()); |
| 497 | |
| 498 | // Construct the full path version of the names. |
| 499 | std::string outpath; |
| 500 | std::string outpathImp; |
| 501 | if (this->GeneratorTarget->IsFrameworkOnApple()) { |
| 502 | outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName()); |
| 503 | cmOSXBundleGenerator::SkipParts bundleSkipParts; |
| 504 | if (this->GeneratorTarget->HasImportLibrary(this->GetConfigName())) { |
| 505 | bundleSkipParts.TextStubs = false; |
| 506 | } |
| 507 | this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output, |
| 508 | outpath, this->GetConfigName(), |
| 509 | bundleSkipParts); |
| 510 | outpath += '/'; |
| 511 | if (!this->TargetNames.ImportLibrary.empty()) { |
| 512 | outpathImp = this->GeneratorTarget->GetDirectory( |
no test coverage detected