forked from bartvdbraak/blender
Build: ignore system paths when using precompiled libraries on Linux
Based on work by Nathan Craddock, with further changes to apply it to all precompiled libraries. Differential Revision: https://developer.blender.org/D6929
This commit is contained in:
parent
9dbfc7ca8b
commit
30b3bf2b57
@ -1167,3 +1167,10 @@ macro(set_and_warn_dependency
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(without_system_libs_begin)
|
||||
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
|
||||
endmacro()
|
||||
|
||||
macro(without_system_libs_end)
|
||||
unset(CMAKE_IGNORE_PATH)
|
||||
endmacro()
|
||||
|
@ -72,26 +72,21 @@ macro(find_package_wrapper)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Precompiled Libraries
|
||||
#
|
||||
# These are libraries that may be precompiled. For this we disable searching in
|
||||
# the system directories so that we don't accidentally use them instead.
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_begin()
|
||||
endif()
|
||||
|
||||
find_package_wrapper(JPEG REQUIRED)
|
||||
find_package_wrapper(PNG REQUIRED)
|
||||
find_package_wrapper(ZLIB REQUIRED)
|
||||
find_package_wrapper(Freetype REQUIRED)
|
||||
|
||||
if(WITH_LZO AND WITH_SYSTEM_LZO)
|
||||
find_package_wrapper(LZO)
|
||||
if(NOT LZO_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system LZO version!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_SYSTEM_EIGEN3)
|
||||
find_package_wrapper(Eigen3)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system Eigen3 version!")
|
||||
endif()
|
||||
endif()
|
||||
# else values are set below for all platforms
|
||||
|
||||
if(WITH_PYTHON)
|
||||
# No way to set py35, remove for now.
|
||||
# find_package(PythonLibs)
|
||||
@ -126,14 +121,6 @@ if(WITH_IMAGE_TIFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
find_package_wrapper(Audaspace)
|
||||
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
|
||||
message(FATAL_ERROR "Audaspace external library not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENAL)
|
||||
find_package_wrapper(OpenAL)
|
||||
if(NOT OPENAL_FOUND)
|
||||
@ -166,13 +153,6 @@ if(WITH_SDL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
find_package_wrapper(Jack)
|
||||
if(NOT JACK_FOUND)
|
||||
set(WITH_JACK OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Codecs
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
find_package_wrapper(SndFile)
|
||||
@ -448,6 +428,13 @@ if(WITH_TBB)
|
||||
find_package_wrapper(TBB)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_end()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Build and Link Flags
|
||||
|
||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||
if(HAIKU)
|
||||
list(APPEND PLATFORM_LINKLIBS -lnetwork)
|
||||
@ -480,6 +467,36 @@ add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||
#
|
||||
# Keep last, so indirectly linked libraries don't override our own pre-compiled libs.
|
||||
|
||||
if(WITH_LZO AND WITH_SYSTEM_LZO)
|
||||
find_package_wrapper(LZO)
|
||||
if(NOT LZO_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system LZO version!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_SYSTEM_EIGEN3)
|
||||
find_package_wrapper(Eigen3)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system Eigen3 version!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Jack is intended to use the system library.
|
||||
if(WITH_JACK)
|
||||
find_package_wrapper(Jack)
|
||||
if(NOT JACK_FOUND)
|
||||
set(WITH_JACK OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
find_package_wrapper(Audaspace)
|
||||
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
|
||||
message(FATAL_ERROR "Audaspace external library not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user