From 454da64c99200de6c1b11ef79f5ef67f4767cf16 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 20 Feb 2008 14:56:29 -0500 Subject: BUG: Link scripts should be generated with copy-if-different and included as a dependency of the link rule. --- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 5 ++++- Source/cmMakefileTargetGenerator.h | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index c1c3b63..9e8d42d 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -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 { diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index bb68d36..dd4c9eb 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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 { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 135b199..08cf6df 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1563,13 +1563,15 @@ void cmMakefileTargetGenerator ::CreateLinkScript(const char* name, std::vector const& link_commands, - std::vector& makefile_commands) + std::vector& makefile_commands, + std::vector& 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::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); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 34a736a..1039f3d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -134,7 +134,8 @@ protected: script at build time. */ void CreateLinkScript(const char* name, std::vector const& link_commands, - std::vector& makefile_commands); + std::vector& makefile_commands, + std::vector& makefile_depends); virtual void CloseFileStreams(); void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, -- cgit v0.12