|
Boost : |
Subject: Re: [boost] [CMake] what to do now?
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-04-14 21:47:15
On 4/14/16 4:02 PM, Andrey Semashev wrote:
> 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.
My understanding is quite different.
In each directory one has a CMakeLists.txt file. This would closely
correspond to current boost practice.
In addition in the parent directory one creates a CMakeLists.txt
directory. It's primary function is to factor common CMake commands
corresponding to the child directories. It includes a statement
add_directory(<child directory name>) for each subdirectory.
Then when you CMake the parent all the children are "CMaked" after
having processed the common code in the parent. As it stands this makes
sense. But if you include common CMake commands in the parent you won't
be able to run CMake on the subdirectories. So if you want to that,
just refrain from factoring common code in the parent directory CMake.
I believe that CMake has an "include" facility so you could have it both
ways - start from the parent or the children.
CMake has a few issues.
The documentation is very extensive - but really consists of just a
reference to the CMake functions one can call. There is no overall
sense of how the whole thing is supposed to work. There is a lot of
information on stack overflow, etc to fill this gap. But most find a
way that works and presume that everyone does it that way. Truth is
there is not "canonical" way to do it - but everyone thinks there is and
that they know what it is. Very confusing. I spent a lot of time
studying the system in order to make my "CMake for dummies" cheat sheet
which I included in the Boost Library Incubator. I described the
simplest system which would work for a simple boost library - header
only. My goal was simplicity. If I had nothing else to do I would
expand upon it. But I don't so I can't
Robert Ramey
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk