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

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • 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)

  • 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.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • 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