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

-- 

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

Reply via email to