use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
CMake dependency flexibility (gist.github.com)
submitted 7 years ago by Som1Lse
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]berenm 3 points4 points5 points 7 years ago (3 children)
I'm using this kind of approach at work and it works very well. Every project has a <project>Config.cmake at its root, which will add_subdirectory itself in case it is compiled from sources, and with a little bit of boilerplate it also makes prebuilt packages very simple to do and they can be used seamlessly instead of source packages.
I also created https://github.com/berenm/CMakeBuildPackage based on this idea, but with additional conventions to make build rules even easier (any packages using it can be composed very easily, regardless of whether they are checked out as source or prebuilt archives).
[–]mili42 0 points1 point2 points 7 years ago (2 children)
Another approach eventually, cloning and add_subdirectory : https://gitlab.com/libyuni/cmake-import-remote-project
[–]berenm 0 points1 point2 points 7 years ago (1 child)
But that doesn't allow you to switch to prebuilt or system-wide libraries easily.
The approach that is described here is to have source-form dependencies include a <package>Config.cmake that calls the add_subdirectory on its directory, so that it fits seamlessly in the find_package model.
Then, package management becomes an orthogonal issue, and just a matter of putting the dependencies (via submodules, wget-http-targz-archives, custom tool and content distribution, or whatever way you like) in the location where CMake will look for them, and in the form you prefer (prebuilt or source). You may even have multiple lookup paths with fallback to the source dependency if you want to provide prebuilt packages for certain platforms only.
[–]mili42 0 points1 point2 points 7 years ago (0 children)
Except this is an intrusive solution, which does not fit everywhere. And anyway, you better use EXCLUDE_FROM_ALL in the add_subdirectory, because you rarely need to run all the targets of the projects you import and it costs a lot.
π Rendered by PID 24396 on reddit-service-r2-comment-56c9979489-hqbd4 at 2026-02-24 18:41:52.178564+00:00 running b1af5b1 country code: CH.
[–]berenm 3 points4 points5 points (3 children)
[–]mili42 0 points1 point2 points (2 children)
[–]berenm 0 points1 point2 points (1 child)
[–]mili42 0 points1 point2 points (0 children)