[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.13 1.14 cmComputeLinkDepends.h 1.6 1.7 cmComputeLinkInformation.cxx 1.31 1.32

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 31 12:47:33 EDT 2008


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

Modified Files:
	cmComputeLinkDepends.cxx cmComputeLinkDepends.h 
	cmComputeLinkInformation.cxx 
Log Message:
BUG: Fix bug 6605 more completely

  - CMake 2.4 added link directories for targets linked
    in the optimized configuration even when building debug
  - Old behavior for policy CMP0003 must account for this


Index: cmComputeLinkDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmComputeLinkDepends.h	13 Mar 2008 20:35:39 -0000	1.6
--- cmComputeLinkDepends.h	31 Mar 2008 16:47:31 -0000	1.7
***************
*** 55,58 ****
--- 55,62 ----
    EntryVector const& Compute();
  
+   void SetOldLinkDirMode(bool b);
+   std::set<cmTarget*> const& GetOldWrongConfigItems() const
+     { return this->OldWrongConfigItems; }
+ 
  private:
  
***************
*** 129,132 ****
--- 133,141 ----
    void EmitComponent(NodeList const& nl);
    void DisplayFinalEntries();
+ 
+   // Compatibility help.
+   bool OldLinkDirMode;
+   void CheckWrongConfigItem(std::string const& item);
+   std::set<cmTarget*> OldWrongConfigItems;
  };
  

Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.31
retrieving revision 1.32
diff -C 2 -d -r1.31 -r1.32
*** cmComputeLinkInformation.cxx	21 Mar 2008 01:11:26 -0000	1.31
--- cmComputeLinkInformation.cxx	31 Mar 2008 16:47:31 -0000	1.32
***************
*** 511,514 ****
--- 511,515 ----
    // Compute the ordered link line items.
    cmComputeLinkDepends cld(this->Target, this->Config);
+   cld.SetOldLinkDirMode(this->OldLinkDirMode);
    cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
  
***************
*** 540,543 ****
--- 541,563 ----
      }
  
+   // Finish listing compatibility paths.
+   if(this->OldLinkDirMode)
+     {
+     // For CMake 2.4 bug-compatibility we need to consider the output
+     // directories of targets linked in another configuration as link
+     // directories.
+     std::set<cmTarget*> const& wrongItems = cld.GetOldWrongConfigItems();
+     for(std::set<cmTarget*>::const_iterator i = wrongItems.begin();
+         i != wrongItems.end(); ++i)
+       {
+       cmTarget* tgt = *i;
+       bool implib =
+         (this->UseImportLibrary &&
+          (tgt->GetType() == cmTarget::SHARED_LIBRARY));
+       std::string lib = tgt->GetFullPath(this->Config , implib, true);
+       this->OldLinkDirItems.push_back(lib);
+       }
+     }
+ 
    // Finish setting up linker search directories.
    if(!this->FinishLinkerSearchDirectories())

Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmComputeLinkDepends.cxx	13 Mar 2008 20:35:39 -0000	1.13
--- cmComputeLinkDepends.cxx	31 Mar 2008 16:47:31 -0000	1.14
***************
*** 170,173 ****
--- 170,176 ----
    // Enable debug mode if requested.
    this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
+ 
+   // Assume no compatibility until set.
+   this->OldLinkDirMode = false;
  }
  
***************
*** 184,187 ****
--- 187,196 ----
  
  //----------------------------------------------------------------------------
+ void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
+ {
+   this->OldLinkDirMode = b;
+ }
+ 
+ //----------------------------------------------------------------------------
  std::vector<cmComputeLinkDepends::LinkEntry> const&
  cmComputeLinkDepends::Compute()
***************
*** 461,464 ****
--- 470,477 ----
          actual_libs.push_back(*di);
          }
+       else if(this->OldLinkDirMode)
+         {
+         this->CheckWrongConfigItem(*di);
+         }
  
        // Reset the link type until another explicit type is given.
***************
*** 493,496 ****
--- 506,513 ----
        actual_libs.push_back(li->first);
        }
+     else if(this->OldLinkDirMode)
+       {
+       this->CheckWrongConfigItem(li->first);
+       }
      }
  
***************
*** 810,811 ****
--- 827,848 ----
    fprintf(stderr, "\n");
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item)
+ {
+   if(!this->OldLinkDirMode)
+     {
+     return;
+     }
+ 
+   // For CMake 2.4 bug-compatibility we need to consider the output
+   // directories of targets linked in another configuration as link
+   // directories.
+   if(cmTarget* tgt = this->Makefile->FindTargetToUse(item.c_str()))
+     {
+     if(!tgt->IsImported())
+       {
+       this->OldWrongConfigItems.insert(tgt);
+       }
+     }
+ }



More information about the Cmake-commits mailing list