diff options
author | Brad King <brad.king@kitware.com> | 2021-05-20 20:52:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-25 14:48:26 (GMT) |
commit | 48471cfd18d5b2b6b4fd7270d21732335156d086 (patch) | |
tree | 321745f3f72fad5efdaa349499f42b2aaf2626ec /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 18408c0b88423a40d239705eb28b65b481cf0973 (diff) | |
download | CMake-48471cfd18d5b2b6b4fd7270d21732335156d086.zip CMake-48471cfd18d5b2b6b4fd7270d21732335156d086.tar.gz CMake-48471cfd18d5b2b6b4fd7270d21732335156d086.tar.bz2 |
cmNinjaNormalTargetGenerator: Factor out build event byproduct collection
This was left out of commit 68e5f92cad (cmGlobalNinjaGenerator: Factor
out custom command output collection, 2021-05-18).
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index e5e57d2..4c33334 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -1195,7 +1195,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( } } - cmNinjaDeps byproducts; + cmGlobalNinjaGenerator::CCOutputs byproducts(this->GetGlobalGenerator()); if (!tgtNames.ImportLibrary.empty()) { const std::string impLibPath = localGen.ConvertToOutputFormat( @@ -1203,7 +1203,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( vars["TARGET_IMPLIB"] = impLibPath; this->EnsureParentDirectoryExists(impLibPath); if (gt->HasImportLibrary(config)) { - byproducts.push_back(targetOutputImplib); + // Some linkers may update a binary without touching its import lib. + byproducts.ExplicitOuts.emplace_back(targetOutputImplib); if (firstForConfig) { globalGen->GetByproductsForCleanTarget(config).push_back( targetOutputImplib); @@ -1261,8 +1262,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( true, config); localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]); std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); - std::transform(ccByproducts.begin(), ccByproducts.end(), - std::back_inserter(byproducts), this->MapToNinjaPath()); + byproducts.Add(ccByproducts); std::transform( ccByproducts.begin(), ccByproducts.end(), std::back_inserter(globalGen->GetByproductsForCleanTarget()), @@ -1382,12 +1382,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( } // Ninja should restat after linking if and only if there are byproducts. - vars["RESTAT"] = byproducts.empty() ? "" : "1"; + vars["RESTAT"] = byproducts.ExplicitOuts.empty() ? "" : "1"; - for (std::string const& o : byproducts) { - globalGen->SeenCustomCommandOutput(o); - linkBuild.Outputs.push_back(o); - } + linkBuild.Outputs.reserve(linkBuild.Outputs.size() + + byproducts.ExplicitOuts.size()); + std::move(byproducts.ExplicitOuts.begin(), byproducts.ExplicitOuts.end(), + std::back_inserter(linkBuild.Outputs)); + linkBuild.WorkDirOuts = std::move(byproducts.WorkDirOuts); // Write the build statement for this target. bool usedResponseFile = false; |