[CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?
Mario Emmenlauer
mario at emmenlauer.de
Thu Mar 22 07:42:49 EDT 2018
Dear Stephen,
thanks for your great help, I certainly learned something! But for
my current problem, zlib generally uses autotools to build, and the
find_package(ZLIB) is in my case looking for the library, not the
cmake config. Would your idea of CMAKE_MODULE_PATH apply to that?
All the best,
Mario
On 21.03.2018 20:12, Stephen McDowell wrote:
> 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
>
> # 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
>
>
>
Viele Gruesse,
Mario Emmenlauer
--
BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203
Balanstr. 43 mailto: memmenlauer * biodataanalysis.de
D-81669 München http://www.biodataanalysis.de/
More information about the CMake
mailing list