diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 0c55ad1286..88db4daf92 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -104,9 +104,6 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386") # - Only plugins. No package will link to them. set(CMAKE_POSITION_INDEPENDENT_CODE OFF) - # Do not search library in /usr/lib64 - SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) - if (DISABLE_ADVANCE_SIMD) set(ARCH_FLAG "-msse -msse2 -march=i686") else() @@ -123,9 +120,6 @@ elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64") # x86_64 requires -fPIC set(CMAKE_POSITION_INDEPENDENT_CODE ON) - # Search library in /usr/lib64 (Arch Linux) - SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) - if (DISABLE_ADVANCE_SIMD) set(ARCH_FLAG "-msse -msse2") else() @@ -140,9 +134,6 @@ else() # All but i386 requires -fPIC set(CMAKE_POSITION_INDEPENDENT_CODE ON) - # Do not search library in /usr/lib64 - SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) - message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}") endif() diff --git a/cmake/linux-compiler-i386-multilib.cmake b/cmake/linux-compiler-i386-multilib.cmake index ddf7ceaf5d..770f38b483 100644 --- a/cmake/linux-compiler-i386-multilib.cmake +++ b/cmake/linux-compiler-i386-multilib.cmake @@ -7,6 +7,37 @@ set(CMAKE_SYSTEM_PROCESSOR i686) set(CMAKE_C_COMPILER cc -m32) set(CMAKE_CXX_COMPILER c++ -m32) +# cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch. +# Be really strict about what gets used. +if(EXISTS /usr/lib/i386-linux-gnu) + set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /lib32 + /usr/lib /usr/lib64 /usr/lib32 + /usr/local/lib /usr/local/lib64 /usr/local/lib32) + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/i386-linux-gnu) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu) + list(APPEND CMAKE_LIBRARY_PATH /lib/i386-linux-gnu) +elseif(EXISTS /usr/lib32) + set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 + /usr/lib /usr/lib64 + /usr/local/lib /usr/local/lib64) + set(CMAKE_LIBRARY_ARCHITECTURE "../lib32") + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib32) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib32) + list(APPEND CMAKE_LIBRARY_PATH /lib32) +else() + set(CMAKE_SYSTEM_IGNORE_PATH + /lib64 + /usr/lib64 + /usr/local/lib64) + set(CMAKE_LIBRARY_ARCHITECTURE ".") + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib) + list(APPEND CMAKE_LIBRARY_PATH /lib) +endif() +list(REMOVE_DUPLICATES CMAKE_LIBRARY_PATH) + # If given a CMAKE_FIND_ROOT_PATH then # FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run) # FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH.