[Cmake-commits] [cmake-commits] king committed cmComputeLinkInformation.cxx 1.55 1.56 cmComputeLinkInformation.h 1.24 1.25

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Aug 24 13:15:49 EDT 2009


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

Modified Files:
	cmComputeLinkInformation.cxx cmComputeLinkInformation.h 
Log Message:
Factor implicit link info addition into methods

In cmComputeLinkInformation::Compute we add implicit link information
from languages other than the linker language to the end of the link
line.  This factors out that code into separate methods to improve
readability and organization.


Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.55
retrieving revision 1.56
diff -C 2 -d -r1.55 -r1.56
*** cmComputeLinkInformation.cxx	28 Jul 2009 12:36:17 -0000	1.55
--- cmComputeLinkInformation.cxx	24 Aug 2009 17:15:47 -0000	1.56
***************
*** 554,557 ****
--- 554,566 ----
  
    // Add implicit language runtime libraries and directories.
+   this->AddImplicitLinkInfo();
+ 
+   return true;
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmComputeLinkInformation::AddImplicitLinkInfo()
+ {
+   // The link closure lists all languages whose implicit info is needed.
    cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config);
    for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
***************
*** 561,598 ****
      if(*li != this->LinkLanguage)
        {
!       // Add libraries for this language that are not implied by the
!       // linker language.
!       std::string libVar = "CMAKE_";
!       libVar += *li;
!       libVar += "_IMPLICIT_LINK_LIBRARIES";
!       if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
!         {
!         std::vector<std::string> libsVec;
!         cmSystemTools::ExpandListArgument(libs, libsVec);
!         for(std::vector<std::string>::const_iterator i = libsVec.begin();
!             i != libsVec.end(); ++i)
!           {
!           if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end())
!             {
!             this->AddItem(i->c_str(), 0);
!             }
!           }
!         }
  
!       // Add linker search paths for this language that are not
!       // implied by the linker language.
!       std::string dirVar = "CMAKE_";
!       dirVar += *li;
!       dirVar += "_IMPLICIT_LINK_DIRECTORIES";
!       if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
          {
!         std::vector<std::string> dirsVec;
!         cmSystemTools::ExpandListArgument(dirs, dirsVec);
!         this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
          }
        }
      }
  
!   return true;
  }
  
--- 570,611 ----
      if(*li != this->LinkLanguage)
        {
!       this->AddImplicitLinkInfo(*li);
!       }
!     }
! }
  
! //----------------------------------------------------------------------------
! void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
! {
!   // Add libraries for this language that are not implied by the
!   // linker language.
!   std::string libVar = "CMAKE_";
!   libVar += lang;
!   libVar += "_IMPLICIT_LINK_LIBRARIES";
!   if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
!     {
!     std::vector<std::string> libsVec;
!     cmSystemTools::ExpandListArgument(libs, libsVec);
!     for(std::vector<std::string>::const_iterator i = libsVec.begin();
!         i != libsVec.end(); ++i)
!       {
!       if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end())
          {
!         this->AddItem(i->c_str(), 0);
          }
        }
      }
  
!   // Add linker search paths for this language that are not
!   // implied by the linker language.
!   std::string dirVar = "CMAKE_";
!   dirVar += lang;
!   dirVar += "_IMPLICIT_LINK_DIRECTORIES";
!   if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
!     {
!     std::vector<std::string> dirsVec;
!     cmSystemTools::ExpandListArgument(dirs, dirsVec);
!     this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
!     }
  }
  

Index: cmComputeLinkInformation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C 2 -d -r1.24 -r1.25
*** cmComputeLinkInformation.h	27 Jul 2009 16:43:16 -0000	1.24
--- cmComputeLinkInformation.h	24 Aug 2009 17:15:47 -0000	1.25
***************
*** 164,167 ****
--- 164,169 ----
    // Implicit link libraries and directories for linker language.
    void LoadImplicitLinkInfo();
+   void AddImplicitLinkInfo();
+   void AddImplicitLinkInfo(std::string const& lang);
    std::set<cmStdString> ImplicitLinkDirs;
    std::set<cmStdString> ImplicitLinkLibs;



More information about the Cmake-commits mailing list