Boost logo

Boost :

Subject: Re: [boost] Boost CMake update
From: Peter Dimov (lists_at_[hidden])
Date: 2017-10-03 16:58:26


paul wrote:

> Hi all,
>
> So I have been working at converting more of boost tests to cmake
> utilizing the BCM library, here:
>
> https://github.com/boost-cmake/boost/tree/1.64

This looks pretty good.

A few comments:

    include(bcm/share/bcm/cmake/BCMConfig.cmake)

bcm/share/bcm doesn't seem the right place. tools/bcm, more likely.

Looking at
https://github.com/boost-cmake/boost/blob/1.64/libs/core/CMakeLists.txt as
an example, clean and tidy; but I'd like to know what is the suggested way
of keeping this file up to date. At minimum, this line:

    bcm_setup_version(VERSION 1.64.0)

needs to be updated per each release; how is this to be done?

I had the version in a separate version.cmake file for this reason; so that
version.cmake could be mass-updated by a script after each release, without
having to either regenerate all CMakeLists files - implying that all local
changes would be lost - or requiring maintainers to keep the version up to
date - which they will not.

A similar question arises with the sources and the dependencies, although
those do not change as often or on such a fixed schedule. (I had those in
separate files as well, for similar reasons, although one could go either
way here.)

    find_package(boost_assert)

As I already mentioned a number of times, this in my opinion must be

    find_package(boost_assert VERSION 1.64.0 EXACT)

because there is never, ever, a scenario in which I want boost_core 1.64.0
to link to boost_assert 1.58.0. (Also, REQUIRED, as otherwise errors are not
as informative.)

    target_link_libraries(boost_core INTERFACE boost::assert)

This manual specification of dependencies duplicates the find_package. These
two could potentially be folded into something like

    bcm_dependency(assert INTERFACE)

Moving on to
https://github.com/boost-cmake/boost/blob/1.64/libs/core/test/CMakeLists.txt,

    bcm_test(NAME core_addressof_test SOURCES addressof_test.cpp)

In the Jamfile, this is

    run addressof_test.cpp ;

which automatically generates a name for the test. It would probably be more
convenient if bcm_test could do that itself as well, including adding a
prefix, so that

    bcm_test(SOURCES addressof_test.cpp)

declared core_addressof_test, and

    bcm_test(SOURCES addressof_test.cpp NAME addressof_test_name)

declared core_addressof_test_name so that one did not have to remember to
prefix everything with core_.

Apart from that, nice work, CMake fans ought to be happy. Needs to be
brought up to date with master though. :-)


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