Best practice for cpp projects using CMake

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
sponsored
  1. cmake-init

    The missing CMake project initializer

    Just use cmake-init which sets you up with a variation of the pitchfork layout.

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. moderncpp-project-template

    A Modern C++ cross-platform Project Template with CMake, conan (optional), cppcheck (optional) and clang-format (optional)

  4. chromium

    The official GitHub mirror of the Chromium source

    I don't think the arguments presented in the proposal are a matter of opinion. Not sure I understand exactly what you mean by "searching only headers" or "only test" (though I'm assuming you don't mean something akin to grepping in which case it's very easy to filter by extension), but having the source and header files next to each other makes reading the code base significantly easier. This may not be apparent in small projects, but from personal experience it becomes extremely helpful in large code bases. Take the Chromium project for example (e.g., the networking library https://github.com/chromium/chromium/tree/main/net/base). In a project of this scale, having the header and the source files placed together (and the tests) makes it extremely easy to jump between the declaration of a class for instance, and its implementation or related unit tests (which I believe is an important process). I rarely find myself wanting to look at only the header files of a given project. I do, however, often jump between the declaration of a class in a header file and its implementation in the corresponding source file, and having them next to each other makes it very easy.

  5. pitchfork

    Pitchfork is a Set of C++ Project Conventions

    Just use cmake-init which sets you up with a variation of the pitchfork layout.

  6. modern-cmake

    (source project on gitlab is https://gitlab.com/CLIUtils/modern-cmake)

  7. cmake_conan_boilerplate_template

    Discontinued Minimized version of cpp_starter_project

  8. cmkr

    Modern build system based on CMake and TOML.

    I would like to counter with a project I’ve been working on: https://cmkr.build. Unfortunately writing good CMake is extremely repetitive and there is definitely room for a generator that has sane defaults.

  9. platform_system_core

    As far as scientific studies go, I'm not sure if there are any that support the arguments of the linked proposal, but if you take a look at some of the most complex, large scale projects out there, you'll notice that they follow to a large extent the same structure as the one outlined in the above proposal. For instance, checkout the Google Chromium project, the AOSP projects, abseil, folly and many others. Of course, there will be exceptions so this is not a foolproof argument but I think it's interesting that projects of this scale have been designed this way.

  10. abseil-cpp

    Abseil Common Libraries (C++)

    As far as scientific studies go, I'm not sure if there are any that support the arguments of the linked proposal, but if you take a look at some of the most complex, large scale projects out there, you'll notice that they follow to a large extent the same structure as the one outlined in the above proposal. For instance, checkout the Google Chromium project, the AOSP projects, abseil, folly and many others. Of course, there will be exceptions so this is not a foolproof argument but I think it's interesting that projects of this scale have been designed this way.

  11. Folly

    An open-source C++ library developed and used at Facebook.

    As far as scientific studies go, I'm not sure if there are any that support the arguments of the linked proposal, but if you take a look at some of the most complex, large scale projects out there, you'll notice that they follow to a large extent the same structure as the one outlined in the above proposal. For instance, checkout the Google Chromium project, the AOSP projects, abseil, folly and many others. Of course, there will be exceptions so this is not a foolproof argument but I think it's interesting that projects of this scale have been designed this way.

  12. fixed-size-string-buffer

    A pre-allocated ring buffer for std::string messages

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Conan Unrecongnized commands error

    1 project | /r/cpp_questions | 11 May 2023
  • Recourses to help understand libraries/projects and setting them up?

    2 projects | /r/cpp_questions | 28 Apr 2023
  • CMake+Conan2 project template example repositories?

    4 projects | /r/cpp | 15 Apr 2023
  • vcpkg vs conan

    1 project | /r/cpp | 21 Mar 2023
  • Help understanding Project Setups

    2 projects | /r/cpp_questions | 10 Mar 2023

Did you know that C++ is
the 7th most popular programming language
based on number of references?