[Cmake-commits] CMake branch, next, updated. v2.8.7-2699-g57bcbdd

Rolf Eike Beer eike at sf-mail.de
Sat Feb 18 10:19:43 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  57bcbdd4b7d1537653257f559fb847eae74d7a01 (commit)
       via  70f362305f20cc1e915a8b0289751d4ed41b60ca (commit)
      from  12ab4af0b9422b67ea975a3579a7c93cabae3a6b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57bcbdd4b7d1537653257f559fb847eae74d7a01
commit 57bcbdd4b7d1537653257f559fb847eae74d7a01
Merge: 12ab4af 70f3623
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Sat Feb 18 10:19:39 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Feb 18 10:19:39 2012 -0500

    Merge topic 'findlibrary-versioned-libraries' into next
    
    70f3623 Find_library(): allow searching for versioned shared objects


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70f362305f20cc1e915a8b0289751d4ed41b60ca
commit 70f362305f20cc1e915a8b0289751d4ed41b60ca
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Wed Feb 15 19:55:57 2012 +0100
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Sat Feb 18 16:19:29 2012 +0100

    Find_library(): allow searching for versioned shared objects
    
    This did not work because find_library() did only treat the given name as
    complete filename if is matched "PREFIX.*SUFFIX":
    
    find_library(MYLIB libfoo.so.2)
    
    Now it is also taken as a whole if the name matches "PREFIX.*SUFFIX\..*".

diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 2fa2cca..a726849 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -354,13 +354,23 @@ void cmFindLibraryHelper::RegexFromList(std::string& out,
 //----------------------------------------------------------------------------
 bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
 {
-  // Check if the given name ends in a valid library suffix.
   for(std::vector<std::string>::const_iterator si = this->Suffixes.begin();
       si != this->Suffixes.end(); ++si)
     {
-    std::string const& suffix = *si;
-    if(name.length() > suffix.length() &&
-       name.substr(name.size()-suffix.length()) == suffix)
+    std::string suffix = *si;
+    if(name.length() <= suffix.length())
+      {
+      continue;
+      }
+    // Check if the given name ends in a valid library suffix.
+    if(name.substr(name.size()-suffix.length()) == suffix)
+      {
+      return true;
+      }
+    // Check if a valid library suffix is somewhere in the name,
+    // this may happen e.g. for versioned shared libraries: libfoo.so.2
+    suffix += ".";
+    if(name.find(suffix) != name.npos)
       {
       return true;
       }
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index b505019..ec3ad39 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -199,7 +199,9 @@ CONFIGURE_FILE(
   ${Complex_SOURCE_DIR}/Library/dummy
   ${Complex_BINARY_DIR}/Library/dummylib.lib
   COPYONLY IMMEDIATE)
-FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl)
+FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl
+         ${CMAKE_SHARED_LIBRARY_SUFFIX}.2
+         ${CMAKE_STATIC_LIBRARY_SUFFIX}.2)
   CONFIGURE_FILE(
     ${Complex_SOURCE_DIR}/Library/dummy
     ${Complex_BINARY_DIR}/Library/libdummylib${ext}
@@ -216,6 +218,34 @@ FIND_LIBRARY(FIND_DUMMY_LIB
              PATHS
              ${Complex_BINARY_DIR}/Library DOC "find dummy lib")
 
+# This doesn't work for platforms that have a shared library and an import
+# library, like Windows with .dll and .lib. Limit is to ".so" now because it's
+# known to work there.
+IF(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so")
+  FIND_LIBRARY(FIND_DUMMY_SHLIB_VERSIONED
+               NAMES libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2
+               PATHS ${Complex_BINARY_DIR}/Library
+               DOC "find versioned dummy shared lib"
+               NO_DEFAULT_PATH)
+
+  IF(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2")
+    MESSAGE(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: "
+            "${FIND_DUMMY_SHLIB_VERSIONED}")
+  ENDIF()
+ENDIF()
+
+# Static library, should work everywhere
+FIND_LIBRARY(FIND_DUMMY_STLIB_VERSIONED
+             NAMES libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2
+             PATHS ${Complex_BINARY_DIR}/Library
+             DOC "find versioned dummy static lib"
+             NO_DEFAULT_PATH)
+
+IF(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2")
+  MESSAGE(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: "
+          "${FIND_DUMMY_STLIB_VERSIONED}")
+ENDIF()
+
 #
 # Test SET_SOURCE_FILES_PROPERTIES 
 #

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list