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

Eric Noulard eric.noulard at gmail.com
Fri Mar 23 07:00:09 EDT 2018


2018-03-23 11:44 GMT+01:00 Mario Emmenlauer <mario at emmenlauer.de>:

>
> Hi Eric,
>
> On 23.03.2018 10:58, Eric Noulard wrote:
> > 2018-03-23 10:21 GMT+01:00 Mario Emmenlauer <mario at emmenlauer.de
> <mailto:mario at emmenlauer.de>>:
> >
> >
> >     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 of specific libs. As an example, if I want to enforce a
> >     patched libtiff (that does not itself provide find_package support)
> >     the only "safe" way is to replace the system libtiff. Otherwise any
> >     package might just find the system version first without me even
> >     knowing.
> >
> >
> > You can always ship your own/patched version of  Find<Whatever>.cmake
> module with your
> > project source and build the 'local' override logic in it for every
> project/lib that does not provide a find_package.
> >
> > Be sure to APPEND your local cmake module path (CMAKE_MODULE_PATH)
> >
> > something like:
> >  list(APPEND CMAKE_MODULE_PATH ${AFS_SOURCE_DIR}/cmake)
> >
> > before using find_package etc...
> >
> > I find it a "safer" solution than system lib replacement.
> > My opinion though.
>
> I was considering this option too. But in my original email I outlined
> that this is not only for my own package, but additionally for more than
> 30 thirdparty dependencies. So its not only about ensuring that my
> packages use the correct thirdparty version, furthermore the packages
> themselves have inter-dependencies that must be correctly resolved.
>

Sorry I missed that part on third party.



> So I'd need to ship my own FindZLIB, FindTIFF, FindPNG, FindJPEG,
> FindPROJ4,
> FindHDF5, FindFFTW, ... etcetc, and override the ones of all my thirdparty
> dependencies. It would create a maintenance hell :-(
>

Yep I can perfectly imagine.
I know well a project for which we do exactly that.

1) Collect all third party sources for which we want to control precise
version (and/or need a patch)
2) Configure, compile and install them all on a private dir
3) Configure and  build my project using those installed 3rd party libs.

this is the only way we can find to have "clean" multi-linux-distrib'
support.


How are other people resolving this?
>

I'm interesting in this as well, but as soon as a 3rd party is using
something you use
you end-up putting your hand in third party or override system lib (which
is not an option for us).

-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180323/5147d595/attachment-0001.html>


More information about the CMake mailing list