Boost logo

Boost :

Subject: Re: [boost] [CMake] what to do now?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-04-14 19:02:51


On 2016-04-15 01:09, Edward Diener wrote:
> On 4/14/2016 5:17 PM, Andrey Semashev wrote:
>> On 2016-04-14 22:00, Edward Diener wrote:
>>> On 4/14/2016 1:37 PM, Rene Rivera wrote:
>>>> On Thu, Apr 14, 2016 at 12:33 PM, Louis Dionne <ldionne.2_at_[hidden]>
>>>> wrote:
>>>>
>>>>>
>>>>> Don't overthink it. All I'm saying is that the Boost guidelines
>>>>> recommend
>>>>> that
>>>>> CMakeLists.txt should appear in $some_library/build/CMakeLists.txt,
>>>>> while I
>>>>> argue that current practice is to put it in
>>>>> $some_library/CMakeLists.txt.
>>>>>
>>>>
>>>> Just to be clear. It's not a recommendation. It's a requirement.
>>>
>>> Ideally could not one have a CMakeLists.txt file wherever there is
>>> currently a jamfile ? In the library's 'build' directory to build a
>>> non-header only library, in the library's 'doc' directory to build the
>>> docs, in the library's 'test' directory to run the tests etc.
>>
>> Yes, that is possible and what should be done according to the current
>> guidelines. It's just not how it's typically done in other projects that
>> use cmake.
>
> That appears to be a minus for CMake. The build of a library is in my
> mind the summation of the build of its separate parts. Being able to
> build each part of a library ( the library itself, documentation, tests,
> examples etc etc. ) separately must be more flexible than having to
> build every part as a whole. In that respect Boost.Build has got it
> right IMO.

I think you misunderstood me. You can build sources, docs and tests
separately. You can place CMakeLists.txt at the places where Jamfiles
currently are. Each of these CMakeLists.txt would declare their own
project and could be independent from others.

However, the common practice is a bit different. There is typically a
single root CMakeLists.txt, which defines a project and then includes a
number of nested CMakeLists.txt. The nested CMakeLists.txt may or may
not define their projects, that doesn't really matter if you invoke
cmake with the root CMakeLists.txt because you're generating makefiles
for the whole tree in this case. You can also build targets selectively
in this case.


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