Skip to content

FetchContent does not work? #4325

Answered by nlohmann
taehyounpark asked this question in Q&A
Discussion options

You must be logged in to vote

This is how I use the library in a project:

cmake_minimum_required(VERSION 3.20)
project(json_test)

include(FetchContent)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(json)

add_executable(json_test main.cpp)
target_link_libraries(json_test PUBLIC nlohmann_json::nlohmann_json)

and then in main.cpp

#include <nlohmann/json.hpp>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@taehyounpark
Comment options

Answer selected by taehyounpark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants