[CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?
Stephen McDowell
sjm324 at cornell.edu
Wed Mar 21 15:12:01 EDT 2018
Hi Mario,
Do you get different results if you set CMAKE_MODULE_PATH rather than CMAKE_PREFIX_PATH? I wrote a tutorial for how to install a library called librealsense, at the very bottom is what will interest you:
https://gist.github.com/svenevs/f00ed3898d2af6248921b63254aa8cc1#enable-librealsense-for-other-cmake-projects <https://gist.github.com/svenevs/f00ed3898d2af6248921b63254aa8cc1#enable-librealsense-for-other-cmake-projects>
# Allow for `find_package(realsense2)` in CMake projects
export CMAKE_MODULE_PATH="/opt/librealsense/lib/cmake${CMAKE_MODULE_PATH:+:${CMAKE_MODULE_PATH}}"
This environment variable can either be set, or specified like you are doing with cmake .. -DCMAKE_MODULE_PATH=“/data/thirdparty”, noting that depending on where it got installed you may also need an extra lib on that path
/data/thirdparty/lib
I’m sure others on this list know the “right” practice, but when CMAKE_INSTALL_PREFIX=/usr/local, it’s very common to see two possible install locations:
/usr/local/cmake
/usr/local/lib/cmake
AKA just make sure that the zlib folder is a child directory. In the librealsense2 example, I have
$ ls /opt/librealsense2/lib/cmake/
realsense2/
So since /opt/librealsense2/lib/cmake is in my CMAKE_MODULE_PATH, when I do find_package(realsense2), it will find that directory.
I don’t know exactly what Zlib’s install looks like, and I know it matters whether they are using “new” or “old” cmake installation tactics, but hopefully this gets you closer to solving it!
-Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180321/a8f5124d/attachment.html>
More information about the CMake
mailing list