Subject: Re: [boost] [EXTERNAL] Request for a "PolicyReview"regarding 'CMakeLists.txt'
From: Peter Dimov (lists_at_[hidden])
Date: 2016-05-20 11:34:32


Paul Fultz II wrote:

> Globbing for ‘libs/*/CMakeLists.txt` will only find the top-level cmake
> files.

Yes, at it will miss those that are more than one level deep. Although it
doesn't really matter.

One sensible arrangement will be

$BOOST_ROOT
    CMakeLists.txt
    status/
        CMakeLists.txt
    libs/
        bind/
            test/
                CMakeLists.txt
        filesystem/
            build/
                CMakeLists.txt
            test/
                CMakeLists.txt
        hana/
            CMakeLists.txt
            test/
                CMakeLists.txt
        hypot/
            CMakeLists.txt
            build/
                CMakeLists.txt
            test/
                CMakeLists.txt

Here, libs/bind/test/CMakeLists.txt defines the target bind.test,
libs/filesystem/build/CMakeLists.txt defines the target filesystem.build,
and so on. The top level CMakeLists.txt globs recursively for
build/CMakeLists.txt and declares a default target that builds everything.
status/CMakeLists.txt globls recursively for test/CMakeLists.txt and
declares a 'test' or 'check' target that tests everything.

libs/hypot/CMakeLists.txt, which is used when standalone, includes
build/CMakeLists.txt and test/CMakeLists.txt and declares a default target
that depends on hypot.build and a check target that depends on hypot.test.

So, only the libraries that support standalone deployment have a top-level
CMakeLists.txt.

There are probably other ways to do it, but this one seems fairly
straightforward.