Boost logo

Boost :

Subject: [boost] [cmake] Pull request announcement
From: mike.dev_at_[hidden]
Date: 2018-09-14 16:34:37


> -----Original Message-----
> From: Boost <boost-bounces_at_[hidden]> On Behalf Of Peter Dimov
> via Boost
> Sent: Friday, September 14, 2018 6:25 PM
> To: boost_at_[hidden]
> Cc: Peter Dimov <lists_at_[hidden]>
> Subject: Re: [boost] [cmake] Pull request announcement
>
> mike wrote:
>
> > We are talking about 5-10 lines of cmake code + one line per dependency
> > (the way I tend to format them).
>
> I suggest you use my approach of including cmake/dependencies.cmake,

Frankly, I don't see the advantage to split such a trivial file:

cmake_minimum_required(VERSION 3.5)
project(boost-foo)

add_library(boost_foo INTERFACE)
add_library(Boost::foo alias boost_foo)
target_include_directories(boost_foo INTERFACE include)

target_link_libraries(boost_foo INTERFACE
        Boost::bar
        Boost::baz
        Boost::miaow
        ...
)

That's it for a header only library (as I said, I won't deal with testing, installation etc)
For a more complex file, I see the benefit of splitting it up

> I (somewhat arbitrarily) chose to use boost::libname as imported target
> name, not sure if Boost:: is better.

Boost:: is what cmake is currently using when using find_package(Boost ...)

Best

Mike


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk