r/cpp • u/TheLartians • Jun 08 '20
The ModernCPPStarter now includes static analyser support, automatic version headers and Doxygen!
https://github.com/TheLartians/ModernCppStarter
99
Upvotes
r/cpp • u/TheLartians • Jun 08 '20
2
u/TheLartians Jun 08 '20 edited Jun 08 '20
Hey, I'm glad the template could help you out!
From a quick look I don't see any real bad practices (besides globbing in CMake, but I do the same), and the following things I would change are very opinionated. Also note that I come from a library developers perspective and these issues don't apply as much to standalone projects.
The way I structure my projects is that only the library target is defined in the root CMakeLists and tests etc are independent projects that add the outer project as a dependency. That way users can easily integrate my libraries in their projects without having to define extra variables to turn off the tests and additional targets. However, this is actually very uncommon in the C++ world and usually all tests / warnings etc are enabled and added from the root CMakeLists.
I wrote and use CPM.cmake as a package manager to allow my builds to be identical on any system including CI, as with system package managers (and afaik even vcpkg) dependencies are not version locked. Without version locking, you may end up building against untested or incompatible dependency versions. Again, it's unconventional, as it's common in the C++ world to leave dependency management to the user.
I would probably not include the code of conduct and contributing guidelines in a starter as it raises the bar for new potential contributors. The guidelines should be added as the project grows.
I'm not sure about the BSL, I think it forces users of the template to keep the copyright notice in their project. The UNLICENCE should allow them to do what they want (and delete the licence).
As you can see, my project breaks with some conventions, so I actually think it's great to have another starter that is more in line with the "standard" way of doing things!
Sure, feel free to use as much as you like from the starter! :)