Bläddra i källkod

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

Brad King 18 år sedan
förälder
incheckning
454da64c99

+ 1 - 1
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
     {

+ 1 - 1
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
     {

+ 4 - 1
Source/cmMakefileTargetGenerator.cxx

@@ -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);
 }
 
 //----------------------------------------------------------------------------

+ 2 - 1
Source/cmMakefileTargetGenerator.h

@@ -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,