Commit eec70a77 authored by Andrey Kamaev's avatar Andrey Kamaev

Architecture dependent library path on unix

parent 4ac407e7
...@@ -24,12 +24,6 @@ endif() ...@@ -24,12 +24,6 @@ endif()
# but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command # 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 # so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE
if(NOT 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 # it _must_ go before project(OpenCV) in order to work
if(WIN32) if(WIN32)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
...@@ -79,6 +73,34 @@ include(cmake/OpenCVUtils.cmake REQUIRED) ...@@ -79,6 +73,34 @@ include(cmake/OpenCVUtils.cmake REQUIRED)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
include(cmake/OpenCVDetectCXXCompiler.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 # OpenCV cmake options
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment