[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-507-g73a8f56

Brad King brad.king at kitware.com
Wed Mar 5 10:57:01 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  73a8f565a56ccccce4e0738bc0214cfd1d4d7690 (commit)
       via  77b035909678fe5ff287f415d0887921f360aacd (commit)
      from  997c8dbda3cfb297a40d2c99b29344c74fb89d18 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73a8f565a56ccccce4e0738bc0214cfd1d4d7690
commit 73a8f565a56ccccce4e0738bc0214cfd1d4d7690
Merge: 997c8db 77b0359
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Mar 5 10:57:00 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Mar 5 10:57:00 2014 -0500

    Merge topic 'link-libraries-response-files' into next
    
    77b03590 Windows: Use response files for link libraries only where supported


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77b035909678fe5ff287f415d0887921f360aacd
commit 77b035909678fe5ff287f415d0887921f360aacd
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Mar 5 10:48:59 2014 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 5 10:49:19 2014 -0500

    Windows: Use response files for link libraries only where supported
    
    The NMake Makefiles generator already puts link libraries in an inline
    response file and at least the VS <= 7.1 tools do not support nested
    response files.  GNU 3.x compilers do not support response files so we
    pass them to the linker using -Wl,@ but link libraries are generated
    with options meant for the compiler front-end so passing them through
    a response file to the linker does not always work.

diff --git a/Help/release/dev/link-libraries-response-files.rst b/Help/release/dev/link-libraries-response-files.rst
index 624abf5..cecf7f6 100644
--- a/Help/release/dev/link-libraries-response-files.rst
+++ b/Help/release/dev/link-libraries-response-files.rst
@@ -1,9 +1,5 @@
 link-libraries-response-files
 -----------------------------
 
-* The Makefile generators learned to use response files with
-  GNU tools on Windows to pass the list of link directories
-  and libraries when linking executables and shared libraries.
-  This matches the approach already used for passing include
-  directories to the compiler and object files to the linker
-  or archiver.  It allows very long lists of libraries.
+* The Makefile generators learned to use response files with GNU tools
+  on Windows to pass library directories and names to the linker.
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 2bb7a20..5c5b360 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -87,6 +87,7 @@ macro(__windows_compiler_gnu lang)
   set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
 
   set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
+  set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE})
   set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
 
   # We prefer "@" for response files but it is not supported by gcc 3.
@@ -103,7 +104,9 @@ macro(__windows_compiler_gnu lang)
     endif()
     # The GNU 3.x compilers do not support response files (only linkers).
     set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0)
-  elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS)
+    # Link libraries are generated only for the front-end.
+    set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
+  else()
     # Use "@" to pass the response file to the front-end.
     set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
   endif()
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 4bca752..1802054 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -307,14 +307,26 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     }
 
   // Select whether to use a response file for objects.
-  bool useResponseFile = false;
+  bool useResponseFileForObjects = false;
   {
   std::string responseVar = "CMAKE_";
   responseVar += linkLanguage;
   responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
   if(this->Makefile->IsOn(responseVar.c_str()))
     {
-    useResponseFile = true;
+    useResponseFileForObjects = true;
+    }
+  }
+
+  // Select whether to use a response file for libraries.
+  bool useResponseFileForLibs = false;
+  {
+  std::string responseVar = "CMAKE_";
+  responseVar += linkLanguage;
+  responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES";
+  if(this->Makefile->IsOn(responseVar.c_str()))
+    {
+    useResponseFileForLibs = true;
     }
   }
 
@@ -325,13 +337,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
 
   // Collect up flags to link in needed libraries.
   std::string linkLibs;
-  this->CreateLinkLibs(linkLibs, relink, useResponseFile, depends);
+  this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends);
 
   // Construct object file lists that may be needed to expand the
   // rule.
   std::string buildObjs;
-  this->CreateObjectLists(useLinkScript, false, useResponseFile,
-                          buildObjs, depends);
+  this->CreateObjectLists(useLinkScript, false,
+                          useResponseFileForObjects, buildObjs, depends);
 
   cmLocalGenerator::RuleVariables vars;
   vars.RuleLauncher = "RULE_LAUNCH_LINK";
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 4f053ab..39e00b2 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -474,14 +474,26 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
 
   // Select whether to use a response file for objects.
-  bool useResponseFile = false;
+  bool useResponseFileForObjects = false;
   {
   std::string responseVar = "CMAKE_";
   responseVar += linkLanguage;
   responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
   if(this->Makefile->IsOn(responseVar.c_str()))
     {
-    useResponseFile = true;
+    useResponseFileForObjects = true;
+    }
+  }
+
+  // Select whether to use a response file for libraries.
+  bool useResponseFileForLibs = false;
+  {
+  std::string responseVar = "CMAKE_";
+  responseVar += linkLanguage;
+  responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES";
+  if(this->Makefile->IsOn(responseVar.c_str()))
+    {
+    useResponseFileForLibs = true;
     }
   }
 
@@ -528,7 +540,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     useLinkScript = true;
 
     // Archiving rules never use a response file.
-    useResponseFile = false;
+    useResponseFileForObjects = false;
 
     // Limit the length of individual object lists to less than the
     // 32K command line length limit on Windows.  We could make this a
@@ -546,14 +558,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   std::string linkLibs;
   if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
     {
-    this->CreateLinkLibs(linkLibs, relink, useResponseFile, depends);
+    this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends);
     }
 
   // Construct object file lists that may be needed to expand the
   // rule.
   std::string buildObjs;
-  this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFile,
-                          buildObjs, depends);
+  this->CreateObjectLists(useLinkScript, useArchiveRules,
+                          useResponseFileForObjects, buildObjs, depends);
 
   cmLocalGenerator::RuleVariables vars;
   vars.TargetPDB = targetOutPathPDB.c_str();

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/link-libraries-response-files.rst |    8 ++-----
 Modules/Platform/Windows-GNU.cmake                 |    5 +++-
 Source/cmMakefileExecutableTargetGenerator.cxx     |   22 ++++++++++++++----
 Source/cmMakefileLibraryTargetGenerator.cxx        |   24 +++++++++++++++-----
 4 files changed, 41 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list