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

Mario Emmenlauer mario at emmenlauer.de
Fri Mar 23 06:44:11 EDT 2018


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.

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 :-(

How are other people resolving this?

All the best,

    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