From: Andrey Kamaev Date: Wed, 22 Feb 2012 15:29:23 +0000 (+0000) Subject: Architecture dependent library path on unix X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~5481 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eec70a779372b32d6215e2bf1655f6968813583e;p=platform%2Fupstream%2Fopencv.git Architecture dependent library path on unix --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5919697..721aa45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,12 +24,6 @@ endif() # but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command # so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE if(NOT CMAKE_TOOLCHAIN_FILE) - # Add these standard paths to the search paths for FIND_LIBRARY - # to find libraries from these locations first - if(UNIX) - set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib) - endif() - # it _must_ go before project(OpenCV) in order to work if(WIN32) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") @@ -79,6 +73,34 @@ include(cmake/OpenCVUtils.cmake REQUIRED) # ---------------------------------------------------------------------------- include(cmake/OpenCVDetectCXXCompiler.cmake REQUIRED) +# Add these standard paths to the search paths for FIND_LIBRARY +# to find libraries from these locations first +if(UNIX AND NOT ANDROID) + if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8) + if(EXISTS /lib64) + list(APPEND CMAKE_LIBRARY_PATH /lib64) + else() + list(APPEND CMAKE_LIBRARY_PATH /lib) + endif() + if(EXISTS /usr/lib64) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib64) + else() + list(APPEND CMAKE_LIBRARY_PATH /usr/lib) + endif() + elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4) + if(EXISTS /lib32) + list(APPEND CMAKE_LIBRARY_PATH /lib32) + else() + list(APPEND CMAKE_LIBRARY_PATH /lib) + endif() + if(EXISTS /usr/lib32) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib32) + else() + list(APPEND CMAKE_LIBRARY_PATH /usr/lib) + endif() + endif() +endif() + # ---------------------------------------------------------------------------- # OpenCV cmake options