diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-26 07:20:32 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-26 07:20:32 +0300 |
commit | 45304493176e7160917081561bd209ed10527443 (patch) | |
tree | 79351f9d131c4575b4104c504c1e239020d25c61 /build_files | |
parent | c4bedeb0186b520a5fdb578ab25035ff908a22f4 (diff) |
CMake: resolve issues using pre-compiled & system libraries for Unix
When LIBDIR existed, searching for system libraries would always
first search 'LIBDIR'.
This meant "WITH_SYSTEM_*" would still prefer LIBDIR versions of
libraries if they exist.
The presence of LIBDIR also ignored the setting for WITH_STATIC_LIBS
which is now restored to the cached value once pre-compiled libraries
have been handled.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 5778699ee49..a3b8b17ec19 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -48,6 +48,9 @@ if(NOT DEFINED LIBDIR) unset(LIBDIR_CENTOS7_ABI) endif() +# Support restoring this value once pre-compiled libraries have been handled. +set(WITH_STATIC_LIBS_INIT ${WITH_STATIC_LIBS}) + if(EXISTS ${LIBDIR}) message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") @@ -541,6 +544,15 @@ 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(EXISTS ${LIBDIR}) + # Clear the prefix path as it causes the `LIBDIR` to override system locations. + unset(CMAKE_PREFIX_PATH) + + # Since the pre-compiled `LIBDIR` directories have been handled, don't prefer static libraries. + set(WITH_STATIC_LIBS ${WITH_STATIC_LIBS_INIT}) +endif() + + if(WITH_LZO AND WITH_SYSTEM_LZO) find_package_wrapper(LZO) if(NOT LZO_FOUND) |