BoilerPlate  0.1.0
C++/CMake modern boilerplate

This is a template for new projects, gives a good CMake base and a few dependencies you most likely want in your project. It also set ups some basic CI builds.

It uses "modern" CMake, ie 3.x paradigms, and should be a good starting point for both people willing to learn it and those that want to update/upgrade their CMakeLists.txt!

Everything will not necessarily be useful for new projects, but serves as a learning document where most of the CMake features you will need should be showcased.

If you disagree with some pieces of advice given here, please discuss it with me by opening a Github Issue! Enhancements are always welcome.

Usage

If you want to bootstrap a new project you only need to :

The CI providers used and that might need some setup :

Requirements :

Some features/notes :

FAQ

Q: I'm new to this CMake stuff, where do I start ?

A: I would suggest reading CGold which covers this way better than I could.


Q: Why can't I link some new libraries I put inside the external folder ?

A: By default targets are not at the GLOBAL scope, which means your CMakelists.txt might not see it. In this case you can either add an alias/imported library or use find_package/library as you would if the library was not in your buildtree.


Q: Should I always put my dependencies in the folder external

A: Absolutely not ! It is a great place for small libraries, but you probably don't want to have to rebuild big libs every time. For those, you can use a package manager such as Hunter or simply rely on find_package/library.


Q: I don't understand why you made the choice of XXXXXX here ?

A: Open a new issue !

External dependencies (using submodules)

Those dependencies can be easily removed by changing the external/CMakelists.txt and cleaning main.cpp.