Ninja: Make import libraries BYPRODUCTs instead of regular OUTPUTs

The MSVC linker may update a binary without touching the associated
import library.

Making the import library a BYPRODUCT prevents the linker from
unnecessarily rerunning when the import library does not get regenerated
as previously expected.
This commit is contained in:
Nils Gladitz 2015-07-28 14:02:47 +02:00
parent 9e29319447
commit 35fb0bb8c0
1 changed files with 3 additions and 2 deletions

View File

@ -546,6 +546,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
} }
cmNinjaDeps byproducts;
if (!this->TargetNameImport.empty()) if (!this->TargetNameImport.empty())
{ {
const std::string impLibPath = localGen.ConvertToOutputFormat( const std::string impLibPath = localGen.ConvertToOutputFormat(
@ -555,7 +557,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
EnsureParentDirectoryExists(impLibPath); EnsureParentDirectoryExists(impLibPath);
if(target.HasImportLibrary()) if(target.HasImportLibrary())
{ {
outputs.push_back(targetOutputImplib); byproducts.push_back(targetOutputImplib);
} }
} }
@ -601,7 +603,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
&postBuildCmdLines &postBuildCmdLines
}; };
cmNinjaDeps byproducts;
for (unsigned i = 0; i != 3; ++i) for (unsigned i = 0; i != 3; ++i)
{ {
for (std::vector<cmCustomCommand>::const_iterator for (std::vector<cmCustomCommand>::const_iterator