CMake: How to include the headers of an external library downloaded with FetchContent?

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

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. eigen

    cmake_minimum_required(VERSION 3.15) project(app) include(FetchContent) FetchContent_Declare(Eigen3 URL https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz) FetchContent_MakeAvailable(Eigen3) add_executable(app main.cpp) target_link_libraries(app Eigen3::Eigen)

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. cmake-init

    The missing CMake project initializer

    Use a package manager such as Conan or vcpkg. You can check cmake-init to see how to integrate them in an idiomatic fashion.

  4. json

    JSON for Modern C++

    Thank you for your suggestion. I decided to use URL because it was recommended in another repository (not Eigen's). Search for "It is recommended to use the URL approach described above" here. Does it make sense? I assume that downloads are faster this way.

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

  • C++ Reflection for Component Serialization and Inspection

    3 projects | /r/gameenginedevs | 4 Mar 2023
  • Abusing C to Implement JSON Parsing with Struct Methods

    4 projects | news.ycombinator.com | 1 Mar 2025
  • Show HN: Sorcerer (YC S24) – Weather balloons that collect more data

    4 projects | news.ycombinator.com | 19 Aug 2024
  • Json-c error

    2 projects | /r/C_Programming | 23 Feb 2023
  • PocketPy: A Lightweight(~5000 LOC) Python Implementation in C++17

    8 projects | /r/cpp | 6 Feb 2023

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