Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-23 Thread Eric Noulard
2018-03-23 11:44 GMT+01:00 Mario Emmenlauer : > > Hi Eric, > > On 23.03.2018 10:58, Eric Noulard wrote: > > 2018-03-23 10:21 GMT+01:00 Mario Emmenlauer >: > > > > > > Thanks PF, I think this makes more sense now! I was

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-23 Thread Mario Emmenlauer
Hi Eric, On 23.03.2018 10:58, Eric Noulard wrote: > 2018-03-23 10:21 GMT+01:00 Mario Emmenlauer >: > > > Thanks PF, I think this makes more sense now! I was assuming that > cmake always prefers CMAKE_PREFIX_PATH over builtin paths.

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-23 Thread Eric Noulard
2018-03-23 10:21 GMT+01:00 Mario Emmenlauer : > > Thanks PF, I think this makes more sense now! I was assuming that > cmake always prefers CMAKE_PREFIX_PATH over builtin paths. But as you > clarified, that only applies to libraries that provide find_package > support. > >

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-23 Thread Mario Emmenlauer
Thanks PF, I think this makes more sense now! I was assuming that cmake always prefers CMAKE_PREFIX_PATH over builtin paths. But as you clarified, that only applies to libraries that provide find_package support. This is actually quite unfortunate. Then I don't see an easy way to enforce usage

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-22 Thread P F via CMake
Are you setting `CMAKE_INSTALL_PREFIX`? This path is searched before the `CMAKE_PREFIX_PATH` is searched. Also the find_package paths listed in the documentation are only for libraries that provide find_package support. Zlib does not, so it cmake fallsback on the FindZLIB.cmake module to do

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-22 Thread Stephen McDowell
That’s progress though? :) Hmmm. I understand your problem now, but I don’t know how to fix it. You can do things like find_package(ZLIB NO_DEFAULT_PATH) That makes it so the system Zlib won’t be found, but I couldn’t then get `cmake .. -DZLIB_ROOT=xxx` to work :/ There are other NO_*

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-22 Thread Mario Emmenlauer
Dear Stephen, thanks a lot for your support! I've tested and your suggestion works! But, it does not fully resolve my pain :-( I'm slightly scared now because I assumed that cmake would prefer CMAKE_PREFIX_PATH over system libraries. In my understanding, the documentation says CMAKE_PREFIX_PATH

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-22 Thread Stephen McDowell
Hi Mario, Very sorry, I should have looked more closely! CMAKE_MODULE_PATH is for libraries that install their own CMake scripts. You are correct, Zlib only installs a pkg-config script. However, FindZLIB.cmake doesn’t appear to use that at all (aka I don’t believe you need to be setting

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-22 Thread Mario Emmenlauer
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,

Re: [CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-21 Thread Stephen McDowell
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:

[CMake] should zlib be searched in CMAKE_PREFIX_PATH or am I confused?

2018-03-21 Thread Mario Emmenlauer
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