[Cmake-commits] [cmake-commits] king committed cmMakefileExecutableTargetGenerator.cxx 1.50 1.51 cmMakefileLibraryTargetGenerator.cxx 1.66 1.67 cmMakefileTargetGenerator.cxx 1.106 1.107 cmMakefileTargetGenerator.h 1.25 1.26

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 15 10:21:16 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1608/Source

Modified Files:
	cmMakefileExecutableTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.cxx 
	cmMakefileTargetGenerator.cxx cmMakefileTargetGenerator.h 
Log Message:
ENH: Factor out listing of objects on command line

Previously generation of object file lists for linker and cleaning
command lines was duplicated for library and executable target
generators.  This combines the implementations.


Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.66
retrieving revision 1.67
diff -C 2 -d -r1.66 -r1.67
*** cmMakefileLibraryTargetGenerator.cxx	15 Oct 2008 14:21:03 -0000	1.66
--- cmMakefileLibraryTargetGenerator.cxx	15 Oct 2008 14:21:14 -0000	1.67
***************
*** 688,721 ****
    // Construct object file lists that may be needed to expand the
    // rule.
-   std::string variableName;
-   std::string variableNameExternal;
-   this->WriteObjectsVariable(variableName, variableNameExternal);
    std::string buildObjs;
!   if(useResponseFile)
!     {
!     std::string objects;
!     this->WriteObjectsString(objects);
!     std::string objects_rsp =
!       this->CreateResponseFile("objects.rsp", objects, depends);
!     buildObjs = "@";
!     buildObjs += this->Convert(objects_rsp.c_str(),
!                                cmLocalGenerator::NONE,
!                                cmLocalGenerator::SHELL);
!     }
!   else if(useLinkScript)
!     {
!     if(!useArchiveRules)
!       {
!       this->WriteObjectsString(buildObjs);
!       }
!     }
!   else
!     {
!     buildObjs = "$(";
!     buildObjs += variableName;
!     buildObjs += ") $(";
!     buildObjs += variableNameExternal;
!     buildObjs += ")";
!     }
    cmLocalGenerator::RuleVariables vars;
    vars.TargetPDB = targetOutPathPDB.c_str();
--- 688,695 ----
    // Construct object file lists that may be needed to expand the
    // rule.
    std::string buildObjs;
!   this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFile,
!                           buildObjs, depends);
! 
    cmLocalGenerator::RuleVariables vars;
    vars.TargetPDB = targetOutPathPDB.c_str();

Index: cmMakefileTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C 2 -d -r1.25 -r1.26
*** cmMakefileTargetGenerator.h	8 Apr 2008 04:06:46 -0000	1.25
--- cmMakefileTargetGenerator.h	15 Oct 2008 14:21:14 -0000	1.26
***************
*** 145,148 ****
--- 145,153 ----
                                   std::vector<std::string>& makefile_depends);
  
+   /** Create lists of object files for linking and cleaning.  */
+   void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
+                          bool useResponseFile, std::string& buildObjs,
+                          std::vector<std::string>& makefile_depends);
+ 
    virtual void CloseFileStreams();
    void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,

Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.50
retrieving revision 1.51
diff -C 2 -d -r1.50 -r1.51
*** cmMakefileExecutableTargetGenerator.cxx	15 Oct 2008 14:21:03 -0000	1.50
--- cmMakefileExecutableTargetGenerator.cxx	15 Oct 2008 14:21:14 -0000	1.51
***************
*** 354,384 ****
    // Construct object file lists that may be needed to expand the
    // rule.
-   std::string variableName;
-   std::string variableNameExternal;
-   this->WriteObjectsVariable(variableName, variableNameExternal);
    std::string buildObjs;
!   if(useResponseFile)
!     {
!     std::string objects;
!     this->WriteObjectsString(objects);
!     std::string objects_rsp =
!       this->CreateResponseFile("objects.rsp", objects, depends);
!     buildObjs = "@";
!     buildObjs += this->Convert(objects_rsp.c_str(),
!                                cmLocalGenerator::NONE,
!                                cmLocalGenerator::SHELL);
!     }
!   else if(useLinkScript)
!     {
!     this->WriteObjectsString(buildObjs);
!     }
!   else
!     {
!     buildObjs = "$(";
!     buildObjs += variableName;
!     buildObjs += ") $(";
!     buildObjs += variableNameExternal;
!     buildObjs += ")";
!     }
  
    cmLocalGenerator::RuleVariables vars;
--- 354,360 ----
    // Construct object file lists that may be needed to expand the
    // rule.
    std::string buildObjs;
!   this->CreateObjectLists(useLinkScript, false, useResponseFile,
!                           buildObjs, depends);
  
    cmLocalGenerator::RuleVariables vars;

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.106
retrieving revision 1.107
diff -C 2 -d -r1.106 -r1.107
*** cmMakefileTargetGenerator.cxx	9 Oct 2008 19:30:07 -0000	1.106
--- cmMakefileTargetGenerator.cxx	15 Oct 2008 14:21:14 -0000	1.107
***************
*** 1624,1627 ****
--- 1624,1665 ----
  
  //----------------------------------------------------------------------------
+ void
+ cmMakefileTargetGenerator
+ ::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
+                     bool useResponseFile, std::string& buildObjs,
+                     std::vector<std::string>& makefile_depends)
+ {
+   std::string variableName;
+   std::string variableNameExternal;
+   this->WriteObjectsVariable(variableName, variableNameExternal);
+   if(useResponseFile)
+     {
+     std::string objects;
+     this->WriteObjectsString(objects);
+     std::string objects_rsp =
+       this->CreateResponseFile("objects.rsp", objects, makefile_depends);
+     buildObjs = "@";
+     buildObjs += this->Convert(objects_rsp.c_str(),
+                                cmLocalGenerator::NONE,
+                                cmLocalGenerator::SHELL);
+     }
+   else if(useLinkScript)
+     {
+     if(!useArchiveRules)
+       {
+       this->WriteObjectsString(buildObjs);
+       }
+     }
+   else
+     {
+     buildObjs = "$(";
+     buildObjs += variableName;
+     buildObjs += ") $(";
+     buildObjs += variableNameExternal;
+     buildObjs += ")";
+     }
+ }
+ 
+ //----------------------------------------------------------------------------
  const char* cmMakefileTargetGenerator::GetFortranModuleDirectory()
  {



More information about the Cmake-commits mailing list