فهرست منبع

ENH: Added global property FIND_LIBRARY_USE_LIB64_PATHS to allow lib64 paths to be searched optionally. Turn off the feature on debian systems. This addresses debian report 419007.

Brad King 18 سال پیش
والد
کامیت
eab81489f1
4فایلهای تغییر یافته به همراه23 افزوده شده و 2 حذف شده
  1. 6 0
      Modules/Platform/Linux.cmake
  2. 2 0
      Modules/Platform/UnixPaths.cmake
  3. 8 2
      Source/cmFindLibraryCommand.cxx
  4. 7 0
      Source/cmake.cxx

+ 6 - 0
Modules/Platform/Linux.cmake

@@ -48,3 +48,9 @@ ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE)
 ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
 
 INCLUDE(Platform/UnixPaths)
+
+# Debian has lib64 paths only for compatibility so they should not be
+# searched.
+IF(EXISTS "/etc/debian_version")
+  SET_PROPERTIES(GLOBAL PROPERTIES FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+ENDIF(EXISTS "/etc/debian_version")

+ 2 - 0
Modules/Platform/UnixPaths.cmake

@@ -37,3 +37,5 @@ SET(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
   /lib /usr/lib /usr/lib32 /usr/lib64
   )
 
+# Enable use of lib64 search path variants by default.
+SET_PROPERTIES(GLOBAL PROPERTIES FIND_LIBRARY_USE_LIB64_PATHS TRUE)

+ 8 - 2
Source/cmFindLibraryCommand.cxx

@@ -67,8 +67,14 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
       }
     return true;
     }
-  // add special 64 bit paths if this is a 64 bit compile.
-  this->AddLib64Paths();
+
+  if(this->Makefile->GetCMakeInstance()
+     ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
+    {
+    // add special 64 bit paths if this is a 64 bit compile.
+    this->AddLib64Paths();
+    }
+
   std::string library;
   for(std::vector<std::string>::iterator i = this->Names.begin();
       i != this->Names.end() ; ++i)

+ 7 - 0
Source/cmake.cxx

@@ -2940,6 +2940,13 @@ void cmake::DefineProperties(cmake *cm)
      "platform supports shared libraries. Basically all current general "
      "general purpose OS do so, the exception are usually embedded systems "
      "with no or special OSs.");
+  cm->DefineProperty
+    ("FIND_LIBRARY_USE_LIB64_PATHS", cmProperty::GLOBAL,
+     "Whether FIND_LIBRARY should automatically search lib64 directories.",
+     "FIND_LIBRARY_USE_LIB64_PATHS is a boolean specifying whether the "
+     "FIND_LIBRARY command should automatically search the lib64 variant of "
+     "directories called lib in the search path when building 64-bit "
+     "binaries.");
 }