[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.18 1.19 cmComputeLinkDepends.h 1.9 1.10 cmComputeLinkInformation.cxx 1.41 1.42
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jul 30 10:23:43 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv21096/Source
Modified Files:
cmComputeLinkDepends.cxx cmComputeLinkDepends.h
cmComputeLinkInformation.cxx
Log Message:
BUG: Preserve all non-targets on user link lines
In CMake 2.4 the generated link line for a target always preserved the
originally specified libraries in their original order. Dependencies
were satisfied by inserting extra libraries into the line, though it had
some bugs. In CMake 2.6.0 we preserved only the items on the link line
that are not known to be shared libraries. This reduced excess
libraries on the link line. However, since we link to system libraries
(such as /usr/lib/libm.so) by asking the linker to search (-lm), some
linkers secretly replace the library with a static library in another
implicit search directory (developers can override this by using an
imported target to force linking by full path). When this happens the
order still matters.
To avoid this and other potential subtle issues this commit restores
preservation of all non-target items and static library targets. This
will create cases of unnecessary, duplicate shared libraries on the link
line if the user specifies them, but at least it will work. In the
future we can attempt a more advanced analysis to safely remove
duplicate shared libraries from the link line.
Index: cmComputeLinkDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C 2 -d -r1.9 -r1.10
*** cmComputeLinkDepends.h 30 Apr 2008 22:04:47 -0000 1.9
--- cmComputeLinkDepends.h 30 Jul 2008 14:23:41 -0000 1.10
***************
*** 59,66 ****
{ return this->OldWrongConfigItems; }
- /** Set a regular expression that matches strings ending in a shared
- library extension. */
- void SetSharedRegex(std::string const& regex);
-
private:
--- 59,62 ----
***************
*** 142,146 ****
std::vector<int> OriginalEntries;
void PreserveOriginalEntries();
- std::string SharedRegexString;
// Compatibility help.
--- 138,141 ----
Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -C 2 -d -r1.41 -r1.42
*** cmComputeLinkInformation.cxx 29 Jul 2008 18:57:00 -0000 1.41
--- cmComputeLinkInformation.cxx 30 Jul 2008 14:23:41 -0000 1.42
***************
*** 512,516 ****
cmComputeLinkDepends cld(this->Target, this->Config);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
- cld.SetSharedRegex(this->SharedRegexString);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
--- 512,515 ----
Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmComputeLinkDepends.cxx 30 Jul 2008 13:25:52 -0000 1.18
--- cmComputeLinkDepends.cxx 30 Jul 2008 14:23:41 -0000 1.19
***************
*** 25,29 ****
#include <cmsys/stl/algorithm>
- #include <cmsys/RegularExpression.hxx>
#include <assert.h>
--- 25,28 ----
***************
*** 200,209 ****
//----------------------------------------------------------------------------
- void cmComputeLinkDepends::SetSharedRegex(std::string const& regex)
- {
- this->SharedRegexString = regex;
- }
-
- //----------------------------------------------------------------------------
std::vector<cmComputeLinkDepends::LinkEntry> const&
cmComputeLinkDepends::Compute()
--- 199,202 ----
***************
*** 882,893 ****
void cmComputeLinkDepends::PreserveOriginalEntries()
{
- // In CMake 2.4 and below all link items were included in order
- // preservation. In CMake 2.6 and above we know it is safe to skip
- // shared libraries.
- bool skipShared = !this->LocalGenerator->NeedBackwardsCompatibility(2,4);
-
- // Regular expression to match shared libraries.
- cmsys::RegularExpression shared_lib(this->SharedRegexString.c_str());
-
// Skip the part of the input sequence that already appears in the
// output.
--- 875,878 ----
***************
*** 898,903 ****
{
cmTarget* tgt = this->EntryList[*in].Target;
! if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
! (skipShared && !tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
--- 883,887 ----
{
cmTarget* tgt = this->EntryList[*in].Target;
! if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
{
// Skip input items known to not be static libraries.
***************
*** 922,927 ****
{
cmTarget* tgt = this->EntryList[*in].Target;
! if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
! (skipShared && !tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
--- 906,910 ----
{
cmTarget* tgt = this->EntryList[*in].Target;
! if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
{
// Skip input items known to not be static libraries.
More information about the Cmake-commits
mailing list