|
Boost : |
Subject: Re: [boost] [EXTERNAL] Re: Request for a "Policy Review" regarding 'CMakeLists.txt'
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2016-05-17 22:43:12
> On May 17, 2016, at 8:14 PM, Rene Rivera <grafikrobot_at_[hidden]> wrote:
>
> On Tue, May 17, 2016 at 9:09 PM, Belcourt, Kenneth <kbelco_at_[hidden]>
> wrote:
>
>>
>>> On May 17, 2016, at 6:11 PM, Peter Dimov <lists_at_[hidden]> wrote:
>>>
>>> Paul Fultz II wrote:
>>>
>>>> Ok, you could just do `cmake libs/hana` for the cmake step. However,
>> this won't build hana's dependencies. Another way would be for hana to
>> provide a target just for its test, so using `hana-check` instead of
>> `check`:
>>>>
>>>> git clone git_at_[hidden]:boostorg/boost.git
>>>> mkdir build && cd build
>>>> cmake ../boost
>>>> cmake --build . --target hana
>>>> cmake --build . --target hana-check
>>>> cmake --build . --target install
>>>
>>> Is it possible to write a top-level CMakeLists.txt which would
>> add_subdirectory for each present library in libs/ ? (b2 does this -
>> invoking it at top level automatically works on a subset and builds
>> whatever is present.)
>>
>> Add code like this to the top-level CMakeLists.txt
>>
>> # Add Boost subdirectories
>> SUBDIRS(libs/accumulators)
>> SUBDIRS(libs/algorithm)
>> SUBDIRS(libs/align)
>> ...
>>
>> would look for a CMakeLists.txt file in each subdirectory listed.
>>
>
> Peter meant programatically. As in, pseudo code:
>
> for each libs/*:
> add_subdirectory( X )
>
# Recursive glob to find CMakeLists.tst
FILE(GLOB_RECURSE build_libs ${CMAKE_CURRENT_SOURCE_DIR}/libs CMakeLists.txt)
# Echo to stdout
foreach(library ${build_libs})
message(0 ${library})
endforeach(library)
Hereâs the result:
s988329:boost kbelco$ cmake -F CMakeLists.txt
0/Users/kbelco/Projects/boost/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/compute/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/compute/example/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/compute/perf/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/compute/test/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/compute/test/extra/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/benchmark/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/doc/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/example/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/experimental/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/hana/test/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/serialization/CMake/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/test/build/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/test/doc/snippet/dataset_1/CMakeLists.txt
0/Users/kbelco/Projects/boost/libs/test/test/CMakeLists.txt
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kbelco/Projects/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk