CMake: Make sure zlib folder comes first for precompiled Linux libraries
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 29 Aug 2018 13:05:03 +0000 (15:05 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 29 Aug 2018 13:05:03 +0000 (15:05 +0200)
Without this find_package(ZLIB) will find ZLib from OpenCollada folder,
which has older ABI and is not what was used to link PNG against.

build_files/cmake/platform/platform_unix.cmake

index 74958a8731c7b246ea716eccfbcf8449523ea53f..43a06c673739275df5d65abcb56ce9b1934d5059 100644 (file)
@@ -30,7 +30,10 @@ set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
 
 if(EXISTS ${LIBDIR})
        file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
-       set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
+       # NOTE: Make sure "proper" compiled zlib comes first before the one
+       # which is a part of OpenCollada. They have different ABI, and we
+       # do need to use the official one.
+       set(CMAKE_PREFIX_PATH ${LIBDIR}/zlib ${LIB_SUBDIRS})
        set(WITH_STATIC_LIBS ON)
        set(WITH_OPENMP_STATIC ON)
 endif()