Boost logo

Boost :

Subject: Re: [boost] Proposal for moving Boost to CMake
From: P F (pfultz2_at_[hidden])
Date: 2017-06-20 08:36:45


> On Jun 20, 2017, at 3:25 AM, Mathias Gaunard via Boost <boost_at_[hidden]> wrote:
>
> On 20 June 2017 at 02:28, Louis Dionne via Boost <boost_at_[hidden]>
> wrote:
>
>>
>> So, normally, for a project based on CMake, these XYZConfig.cmake files can
>> be generated automatically by using `install(EXPORT ...)`. The resulting
>> file looks like this (for Hana):
>>
>>
>> https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897
>> ca#file-what-gets-generated-for-hana-cmake
>>
>> Basically, we'd want to replicate the functionality provided by this module
>> without necessarily all the boilerplate (since that's generated
>> automatically). Here's a minimal file for Hana (a header only library):
>>
>>
>> https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897
>> ca#file-minimal-handwritten-config-header-only-cmake
>>
>> And here's a minimal XYZConfig.cmake file for a library with compiled
>> sources (I added source files to Hana and turned it into a static library
>> to
>> check this):
>>
>>
>> https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897
>> ca#file-minimal-handwritten-config-static-cmake
>>
>> Then, each Boost library would simply provide a file like this and install
>> it to the appropriate location when the library is installed. Again, please
>> keep in mind this is only the gist of what would need to be done, not an
>> actual template.
>
>
> I'm not sure this is the right approach, what happens when you have a
> transitive dependency?
> I'd rather just like the direct dependencies, but this format looks like it
> would need to contain the transitive dependencies too.

The transitive dependency is taken care of by calling `find_package` for each dependency. That is, if Boost.Hana depends on Boost.Foo, then Boost.Hana only states that it depends on some target boost::foo, but this will be defined by `find_package(foo)`, which if that depends another library it will go through the same process.


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