[CMake] What is the best way to handle Boost dependencies in a package config file

Johnson, Matt (GE Healthcare) Matthew.Johnson1 at med.ge.com
Wed Jan 27 08:08:39 EST 2016


> -----Original Message-----
> From: Ruslan Baratov [mailto:ruslan_baratov at yahoo.com]
> Sent: Wednesday, January 27, 2016 2:18 AM
> To: Johnson, Matt (GE Healthcare)
> Cc: cmake at cmake.org
> Subject: Re: [CMake] What is the best way to handle Boost dependencies in
> a package config file
> 
> On 27-Jan-16 09:54, Johnson, Matt (GE Healthcare) wrote:
> > I like package config files.  I want to use more of them.  However, I have a
> dependency on boost.  While boost has a Find module, it doesn't have a
> package config file.  I'm not going to be able to depend on the users of my
> package building boost via cmake (also, is that still an active thing?).
> >
> > It seems like the best I could hope for is to generate the package config file,
> then hack it up to deal with the boost stuff.  Has anyone already solved this
> problem or have any tips?  I found this Hunter package manager
> (https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_ruslo_hunter&d=CwIC-
> g&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=qts7iZJBjQRtedrrc
> qcDRKGTou2a2ZKSs95InlFGa34&m=h5ntMfnYSIOG1mQp_twkUPunK5Nz0q9
> HBqa7Ld4B_hs&s=zi9sk8NwKokHEqrLyGA5a_yrRxLdHF9P7ID23wgrWPY&e=
> ), but it seems a bit heavyweight when all I want is boost.
> --
> > Also, I can't have my build system going out and downloading the packages
> - they all have to come from an internal source.
> >
> Just for your information you can use "file://" links instead of regular
> "https://urldefense.proofpoint.com/v2/url?u=http-3A__&d=CwIC-
> g&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=qts7iZJBjQRtedrrc
> qcDRKGTou2a2ZKSs95InlFGa34&m=h5ntMfnYSIOG1mQp_twkUPunK5Nz0q9
> HBqa7Ld4B_hs&s=ts63TtZeGvflnLyyJ8pKESTjxabuzNCPmS0fGn_1L7E&e= " in
> both hunter.cmake and HunterGate so there is no need to "go out" - you can
> be completely offline.
> 
> Ruslo

Ruslo - thanks for that.  I'm seriously going to look into Hunter more.  From my cursory glance at it, it's a seriously impressive bit of cmake scripting.

Can  I ask you a few follow ups? 
1. in the case of boost, what it is doing is using the find package module, then creating import targets based off the information.  Correct?
2. If I require a newer version of boost than what is listed in the gate file, I'd need to  update hunter.cmake and HunterGate,  correct?
3. If I want to distribute my package to others, they too would need  to use Hunter, correct?  Since boost doesn't have a package config file in  its distribution, the dependency targets (e.g. Boost::regex) wouldn't exist on their system)  Any tips on this? 

Thanks again for your hard  work on  Hunter.  I've done a bit of cmake to download and install some dependencies in the past.  Yours is WAY nicer than what I came up with. 

Matt


More information about the CMake mailing list