[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.29 1.30 cmComputeLinkDepends.h 1.15 1.16

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Apr 6 11:10:39 EDT 2009


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

Modified Files:
	cmComputeLinkDepends.cxx cmComputeLinkDepends.h 
Log Message:
BUG: Lookup transitive link deps in depender scope

The transitive link dependencies of a linked target must be followed in
its own scope, not in the scope of the original target that depends on
it.  This is necessary since imported targets do not have global scope.
See issue #8843.


Index: cmComputeLinkDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmComputeLinkDepends.h	4 Sep 2008 21:34:24 -0000	1.15
--- cmComputeLinkDepends.h	6 Apr 2009 15:10:37 -0000	1.16
***************
*** 82,86 ****
    std::map<cmStdString, int>::iterator
    AllocateLinkEntry(std::string const& item);
!   int AddLinkEntry(std::string const& item);
    void AddVarLinkEntries(int depender_index, const char* value);
    void AddTargetLinkEntries(int depender_index,
--- 82,86 ----
    std::map<cmStdString, int>::iterator
    AllocateLinkEntry(std::string const& item);
!   int AddLinkEntry(int depender_index, std::string const& item);
    void AddVarLinkEntries(int depender_index, const char* value);
    void AddTargetLinkEntries(int depender_index,
***************
*** 89,93 ****
                        std::vector<std::string> const& libs);
    std::string CleanItemName(std::string const& item);
!   cmTarget* FindTargetToLink(const char* name);
  
    // One entry for each unique item.
--- 89,93 ----
                        std::vector<std::string> const& libs);
    std::string CleanItemName(std::string const& item);
!   cmTarget* FindTargetToLink(int depender_index, const char* name);
  
    // One entry for each unique item.
***************
*** 163,167 ****
    // Compatibility help.
    bool OldLinkDirMode;
!   void CheckWrongConfigItem(std::string const& item);
    std::set<cmTarget*> OldWrongConfigItems;
  };
--- 163,167 ----
    // Compatibility help.
    bool OldLinkDirMode;
!   void CheckWrongConfigItem(int depender_index, std::string const& item);
    std::set<cmTarget*> OldWrongConfigItems;
  };

Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -C 2 -d -r1.29 -r1.30
*** cmComputeLinkDepends.cxx	4 Sep 2008 21:34:24 -0000	1.29
--- cmComputeLinkDepends.cxx	6 Apr 2009 15:10:34 -0000	1.30
***************
*** 296,300 ****
  
  //----------------------------------------------------------------------------
! int cmComputeLinkDepends::AddLinkEntry(std::string const& item)
  {
    // Check if the item entry has already been added.
--- 296,301 ----
  
  //----------------------------------------------------------------------------
! int cmComputeLinkDepends::AddLinkEntry(int depender_index,
!                                        std::string const& item)
  {
    // Check if the item entry has already been added.
***************
*** 313,317 ****
    LinkEntry& entry = this->EntryList[index];
    entry.Item = item;
!   entry.Target = this->FindTargetToLink(entry.Item.c_str());
    entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' &&
                    item.substr(0, 10) != "-framework");
--- 314,318 ----
    LinkEntry& entry = this->EntryList[index];
    entry.Item = item;
!   entry.Target = this->FindTargetToLink(depender_index, entry.Item.c_str());
    entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' &&
                    item.substr(0, 10) != "-framework");
***************
*** 410,414 ****
      LinkEntry& entry = this->EntryList[lei->second];
      entry.Item = dep.Item;
!     entry.Target = this->FindTargetToLink(dep.Item.c_str());
  
      // This item was added specifically because it is a dependent
--- 411,416 ----
      LinkEntry& entry = this->EntryList[lei->second];
      entry.Item = dep.Item;
!     entry.Target = this->FindTargetToLink(dep.DependerIndex,
!                                           dep.Item.c_str());
  
      // This item was added specifically because it is a dependent
***************
*** 501,505 ****
        else if(this->OldLinkDirMode)
          {
!         this->CheckWrongConfigItem(*di);
          }
  
--- 503,507 ----
        else if(this->OldLinkDirMode)
          {
!         this->CheckWrongConfigItem(depender_index, *di);
          }
  
***************
*** 530,534 ****
      else if(this->OldLinkDirMode)
        {
!       this->CheckWrongConfigItem(li->first);
        }
      }
--- 532,536 ----
      else if(this->OldLinkDirMode)
        {
!       this->CheckWrongConfigItem(depender_index, li->first);
        }
      }
***************
*** 559,563 ****
  
      // Add a link entry for this item.
!     int dependee_index = this->AddLinkEntry(item);
  
      // The dependee must come after the depender.
--- 561,565 ----
  
      // Add a link entry for this item.
!     int dependee_index = this->AddLinkEntry(depender_index, item);
  
      // The dependee must come after the depender.
***************
*** 665,672 ****
  
  //----------------------------------------------------------------------------
! cmTarget* cmComputeLinkDepends::FindTargetToLink(const char* name)
  {
!   // Look for a target.
!   cmTarget* tgt = this->Makefile->FindTargetToUse(name);
  
    // Skip targets that will not really be linked.  This is probably a
--- 667,683 ----
  
  //----------------------------------------------------------------------------
! cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index,
!                                                  const char* name)
  {
!   // Look for a target in the scope of the depender.
!   cmMakefile* mf = this->Makefile;
!   if(depender_index >= 0)
!     {
!     if(cmTarget* depender = this->EntryList[depender_index].Target)
!       {
!       mf = depender->GetMakefile();
!       }
!     }
!   cmTarget* tgt = mf->FindTargetToUse(name);
  
    // Skip targets that will not really be linked.  This is probably a
***************
*** 988,992 ****
  
  //----------------------------------------------------------------------------
! void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item)
  {
    if(!this->OldLinkDirMode)
--- 999,1004 ----
  
  //----------------------------------------------------------------------------
! void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index,
!                                                 std::string const& item)
  {
    if(!this->OldLinkDirMode)
***************
*** 998,1002 ****
    // directories of targets linked in another configuration as link
    // directories.
!   if(cmTarget* tgt = this->FindTargetToLink(item.c_str()))
      {
      if(!tgt->IsImported())
--- 1010,1014 ----
    // directories of targets linked in another configuration as link
    // directories.
!   if(cmTarget* tgt = this->FindTargetToLink(depender_index, item.c_str()))
      {
      if(!tgt->IsImported())



More information about the Cmake-commits mailing list