BUG: Link scripts should be generated with copy-if-different and included as a dependency of the link rule.

This commit is contained in:
Brad King 2008-02-20 14:56:29 -05:00
parent 5e72a0d4e4
commit 454da64c99
4 changed files with 8 additions and 4 deletions

View File

@ -405,7 +405,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
// Use a link script.
const char* name = (relink? "relink.txt" : "link.txt");
this->CreateLinkScript(name, real_link_commands, commands1);
this->CreateLinkScript(name, real_link_commands, commands1, depends);
}
else
{

View File

@ -788,7 +788,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{
// Use a link script.
const char* name = (relink? "relink.txt" : "link.txt");
this->CreateLinkScript(name, real_link_commands, commands1);
this->CreateLinkScript(name, real_link_commands, commands1, depends);
}
else
{

View File

@ -1563,13 +1563,15 @@ void
cmMakefileTargetGenerator
::CreateLinkScript(const char* name,
std::vector<std::string> const& link_commands,
std::vector<std::string>& makefile_commands)
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends)
{
// Create the link script file.
std::string linkScriptName = this->TargetBuildDirectoryFull;
linkScriptName += "/";
linkScriptName += name;
cmGeneratedFileStream linkScriptStream(linkScriptName.c_str());
linkScriptStream.SetCopyIfDifferent(true);
for(std::vector<std::string>::const_iterator cmd = link_commands.begin();
cmd != link_commands.end(); ++cmd)
{
@ -1588,6 +1590,7 @@ cmMakefileTargetGenerator
cmLocalGenerator::SHELL);
link_command += " --verbose=$(VERBOSE)";
makefile_commands.push_back(link_command);
makefile_depends.push_back(linkScriptName);
}
//----------------------------------------------------------------------------

View File

@ -134,7 +134,8 @@ protected:
script at build time. */
void CreateLinkScript(const char* name,
std::vector<std::string> const& link_commands,
std::vector<std::string>& makefile_commands);
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
virtual void CloseFileStreams();
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,