| 448 | } |
| 449 | |
| 450 | void cmNinjaNormalTargetGenerator::WriteLinkRule( |
| 451 | bool useResponseFile, std::string const& config, |
| 452 | std::vector<std::string> const& preLinkComments, |
| 453 | std::vector<std::string> const& postBuildComments) |
| 454 | { |
| 455 | cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType(); |
| 456 | |
| 457 | std::string linkRuleName = this->LanguageLinkerRule(config); |
| 458 | if (!this->GetGlobalGenerator()->HasRule(linkRuleName)) { |
| 459 | cmNinjaRule rule(std::move(linkRuleName)); |
| 460 | cmRulePlaceholderExpander::RuleVariables vars; |
| 461 | vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str(); |
| 462 | vars.CMTargetType = cmState::GetTargetTypeName(targetType).c_str(); |
| 463 | std::string linker = this->GetGeneratorTarget()->GetLinkerTool(config); |
| 464 | vars.Linker = linker.c_str(); |
| 465 | std::string lang = this->TargetLinkLanguage(config); |
| 466 | vars.Language = lang.c_str(); |
| 467 | vars.AIXExports = "$AIX_EXPORTS"; |
| 468 | |
| 469 | if (!this->GetLocalGenerator()->IsSplitSwiftBuild() && |
| 470 | this->TargetLinkLanguage(config) == "Swift") { |
| 471 | vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; |
| 472 | vars.SwiftModule = "$SWIFT_MODULE"; |
| 473 | vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; |
| 474 | vars.SwiftSources = "$SWIFT_SOURCES"; |
| 475 | |
| 476 | vars.Defines = "$DEFINES"; |
| 477 | vars.Flags = "$FLAGS"; |
| 478 | vars.Includes = "$INCLUDES"; |
| 479 | } |
| 480 | |
| 481 | if (this->TargetLinkLanguage(config) == "Rust") { |
| 482 | vars.RustSources = "$RUST_SOURCES"; |
| 483 | vars.RustObjectDeps = "$RUST_OBJECT_DEPS"; |
| 484 | } |
| 485 | |
| 486 | std::string responseFlag; |
| 487 | |
| 488 | std::string cmakeVarLang = |
| 489 | cmStrCat("CMAKE_", this->TargetLinkLanguage(config)); |
| 490 | |
| 491 | if (this->GeneratorTarget->HasLinkDependencyFile(config)) { |
| 492 | auto DepFileFormat = this->GetMakefile()->GetDefinition( |
| 493 | cmStrCat(cmakeVarLang, "_LINKER_DEPFILE_FORMAT")); |
| 494 | rule.DepType = DepFileFormat; |
| 495 | rule.DepFile = "$DEP_FILE"; |
| 496 | } |
| 497 | |
| 498 | // build response file name |
| 499 | std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; |
| 500 | cmValue flag = this->GetMakefile()->GetDefinition(cmakeLinkVar); |
| 501 | |
| 502 | if (flag) { |
| 503 | responseFlag = *flag; |
| 504 | } else { |
| 505 | responseFlag = "@"; |
| 506 | } |
| 507 |
no test coverage detected