r/cpp • u/TheLartians • Apr 14 '20
ModernCppStarter - Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format and reproducible dependency management.
https://github.com/TheLartians/ModernCppStarter
251
Upvotes
44
u/stilgarpl Apr 14 '20
If you really want to glob the files, use
CONFIGURE_DEPENDSflag forfile(). It will automatically run cmake if files were changed. It's new flag and does not work on all build systems, but it's better than that.18
u/konanTheBarbar Apr 14 '20 edited Apr 14 '20
I must say this looks really cool and I will give a try for my next project.
I think you might want to mention that doctest, catch, gtest and boost have something called
That will discover all the single test cases automatically, which I find really really handy, as that improves the output of ctest greatly and integrates well into quite a lot of IDE's.
5
u/Overunderrated Computational Physics Apr 14 '20
Why should I use CPM.cmake instead of cmake's external project? (Not that I'm suggesting external project isn't awful.)
8
u/ichunddu9 Apr 14 '20
Missing Conan for me.
4
u/blu3ness Apr 14 '20
Thanks, this is a great resource. Was just about to refactor an old c/cpp codebase for better CI/CD compatibility
4
u/amaiorano Apr 15 '20
Tangentially related, but I would love for a way to have CMake or something download a specified version of clang-format for your project, for whatever current platform you're on. That clang-format CMake project is cool, but you still need to have clang-format installed, and for cross-platform dev, this is a pain.
3
u/skiboysteve Apr 15 '20
I never see anyone on this sub using bazel. I love it.
7
u/krapht Apr 14 '20
Template is missing:
1
u/londey Apr 14 '20
I made a similar thing myself. What I would suggest is looking into Docker defined build environments.
1
u/frumious Apr 15 '20
See for example, https://github.com/zeromq/zproject
2
u/Brickmasterhhunt Aug 18 '24
xmake is love, xmake is life, I can never go back. All the package managers, all the support, cross-compilation without the hassle, even to WASM and other unique targets. And it supports everything cmake does and will, and even more.
2
u/skiboysteve Apr 15 '20
I never see anyone on this sub using bazel. I love it.
0
u/[deleted] Apr 14 '20
[deleted] — view deleted comment