Dear All, I use find_package(ZLIB) to detect zlib on Ubuntu 16.04 Linux. I have a newer zlib in /data/thirdparty that I'd like to use. To prefer my newer version I add -DCMAKE_PREFIX_PATH="/data/thirdparty". In my understanding, the documentation says CMAKE_PREFIX_PATH is searched first (1). But cmake behaves different than I'd expect:
It detects the system zlib first: -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") And then complains that zlib exists twice: CMake Warning at CMakeLists.txt:693 (add_library): Cannot generate a safe runtime search path for target bdaimage because files in some directories may conflict with libraries in implicit directories: runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /data/thirdparty/lib Some of these libraries may not be found correctly. Why am I misunderstanding the documentation? Is CMAKE_PREFIX_PATH not preferred over system directories? All the best, Mario Emmenlauer (1) https://cmake.org/cmake/help/v3.0/command/find_package.html -- BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203 Balanstr. 43 mailto: memmenlauer * biodataanalysis.de D-81669 München http://www.biodataanalysis.de/ -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake