Boost logo

Boost :

Subject: Re: [boost] [CMake] what to do now?
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2016-04-14 11:50:33


Rene Rivera <grafikrobot <at> gmail.com> writes:

>
> On Wed, Apr 13, 2016 at 6:00 PM, Robert Ramey <ramey <at> rrsd.com> wrote:
>
> > On 4/13/16 3:37 PM, P F wrote:
> >
> >>
> >> The CMakeLists.txt file should be in the top-level directory.
> >>
> >
> > Hmmmm - says who? I realize that this is the common way to do it. But it
> > ends up sprinkling CMakeList.txt files all over the place. Doing it the
> > way I've done makes supporting CMake much less intrusive and leaves the
> > "footprint" of CMake support on par with build (boost build) easily
> > permitting the user to select which he prefers.
>
> <http://www.boost.org/development/requirements.html#Organization>

I think this recommendation is out of line with current practice. From my
experience, the top level CMakeLists.txt file is almost always expected to
appear at the root of the project. Out of the 25 most trending C++ projects
this month on GitHub,

- 8 use CMake as a primary build tool
- out of those, 7 have a CMakeLists.txt file at the root of the project

Unfortunately, there does not seem to be agreement about what build system to
use (many use plain Makefiles), but among the ones that use CMake, agreement
is on the CMakeLists.txt file being at the top level. Other notable projects
that use CMake and include the CMakeLists.txt file at the root are Facebook's
HHVM and Kitware's CMake itself. An example [1] on CMake's website also
suggests doing this.

Finally, FWIW, I think all the CMake-powered projects I've seen so far also
put the top level CMakeLists.txt file at the root (but that is just my
experience).

Personnally, I will need something more authoritative than the requirement
page you link above to be convinced of putting the CMakeLists.txt file in
another place than the root of the project.

Regards,
Louis Dionne

[1]: https://cmake.org/examples/


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