[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 07:57:38 EST 2016


Thanks for the reply, Michi.  Forgive me if I'm missing something - how does this help with your package config file?  Doesn't Boost_LIBRARIES contain full paths to  the component libraries you listed?  My understanding is that in order to have a package config file result in something that can be relocated, I'd need to be able to do something like:

find_package(Boost CONFIG COMPONENTS system filesystem regex REQUIRED)
target_link_libraries(my_target Boost::system Boost::filesystem  Boost::regex)

That is, the  find package would have to create imported targets for the boost dependencies.  As far as I know, FindBoost.cmake does not do this.  Please correct me if I'm wrong - that would make me  most happy! 

Thanks again for the help.

Matt

> -----Original Message-----
> From: Michi Henning [mailto:michi.henning at canonical.com]
> Sent: Wednesday, January 27, 2016 1:55 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
> 
> We use this, which works fine for me on Ubuntu:
> 
> find_package(Boost COMPONENTS system filesystem regex serialization
> thread log REQUIRED)
> 
> Cheers,
> 
> Michi.
> 
> > On 27 Jan 2016, at 12:54 , Johnson, Matt (GE Healthcare)
> <Matthew.Johnson1 at med.ge.com> 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=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh
> _RiV3wUrLrDQYWSI&r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m
> =PrIOuKSVt-ib8BwXCLUzXhcXKOaI-nPRE3lR3m-
> XYH8&s=2LvLkrDkWzloxqrrBP6UdCiiL0YnWgmToNjL2_5mZTw&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.
> >
> > Thanks,
> > Matt
> >
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__www.cmake.org_Wiki
> > _CMake-
> 5FFAQ&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=
> > qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIOuKSVt-
> ib8BwXCLUzXhcX
> > KOaI-nPRE3lR3m-
> XYH8&s=voIOJHSB3_3nWFPCHnLZrEHATQTMvoAv6TceyDyGQZA&e=
> >
> > Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> >
> > CMake Support:
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__cmake.org_cmake_he
> >
> lp_support.html&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQ
> YWSI
> > &r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIOuKSVt-
> ib8BwXCLUzX
> > hcXKOaI-nPRE3lR3m-
> XYH8&s=g65Y7hDTwOo3VrTo2tEH3SUkWkr98xxGzXD1HwzQYsw&e
> > = CMake Consulting:
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__cmake.org_cmake_he
> >
> lp_consulting.html&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLr
> DQY
> > WSI&r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIOuKSVt-
> ib8BwXCL
> > UzXhcXKOaI-nPRE3lR3m-XYH8&s=Ldr318Ilc_hQg2SdaGdLBb-
> iz_KqDMgeeUbtAMAodH
> > U&e= CMake Training Courses:
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__cmake.org_cmake_he
> >
> lp_training.html&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQ
> YWS
> > I&r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIOuKSVt-
> ib8BwXCLUz
> > XhcXKOaI-nPRE3lR3m-
> XYH8&s=QihVB4Y2sUhcmA1sx5eJiP5U6bAEPUiv0eWvBaxQCBM&
> > e=
> >
> > Visit other Kitware open-source projects at
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__www.kitware.com_op
> >
> ensource_opensource.html&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_Ri
> V3wU
> >
> rLrDQYWSI&r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIOuKS
> Vt-ib
> > 8BwXCLUzXhcXKOaI-nPRE3lR3m-
> XYH8&s=HS6ra4DuapPlznsB2bTbsvGRHWo1VqrLEC8W
> > LkNuNE4&e=
> >
> > Follow this link to subscribe/unsubscribe:
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__public.kitware.com
> >
> _mailman_listinfo_cmake&d=CwIFAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV
> 3wUrLrDQYWSI&r=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34&m=PrIO
> uKSVt-ib8BwXCLUzXhcXKOaI-nPRE3lR3m-
> XYH8&s=aXGbP0VkR84NnoG05l6FMHvDll3S2Z788vYWyD5bQp0&e=



More information about the CMake mailing list