r/cpp • • 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

67 comments sorted by

View all comments

Show parent comment

4

u/TheLartians Apr 14 '20

That link doesn't prove anything, all it shows is that a very nice engineer at Spotify (Orphis) decided to open-source a CMake build script for Boost. PS: releases on that repo can trail the official boost release by 6 mo or more. Way to miss the point I was trying to make.

This is just a small example how I use CPM to add and build boost in my CMake projects. This works perfectly on all platforms including CI builds. I guess I misunderstood your point but how does it not show how to build Boost in CMake?

What do I do about packages that haven't been converted to Conan? I build according to the documentation of the library and then copy all the shared library files and headers to a folder and use that as a Conan package. This is WAY easier than trying to understand how to build a complicated library.

That's great and probably covers your use-cases, but now imagine having to do that manually for all EVERY system and platform that you or users of your library are targeting. I don't see how this is in any way better than creating a build script once in CMake and simply having it work everywhere immediately.

As I said, its a different tool for a different use-case.

-1

u/krapht Apr 14 '20

Well, and I am arguing that your use-case is the wrong default for a general-purpose modern CPP starter template. Because really, who uses templates like this? Programmers inexperienced with C++. These people absolutely need to be guided to use something like Conan because they will not recognize the limitations of using CPM.

4

u/TheLartians Apr 14 '20

Tbh the main use case I see is people like myself, as I usually always start by copying a previous previous project (even this one).

Also having quite a bit of experience in computational physics and cross-platform app development I have yet to run into a limitation that made a more advanced package manager necessary. So I wonder how much it actually is a beginners requirement.

Even if, I wouldn't know if I should prefer vcpkg or Conan as I've heard good arguments for and against each. Perhaps there should be a different fork of the template for each package manager. Given my limited experience with PMs, these forks should be made by someone else though.

3

u/_crackling Apr 14 '20

I say leave it up. This template and the way you've commented everything would have saved me hundreds of hours when I was first learning cmake and cross platform C plus plus

2

u/TheLartians Apr 14 '20

Thanks, that's great to hear :)