nlohmann_json¶
Note
C++ 11 is required, you can find the supported compiler versions in the official README.
Usage¶
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PUBLIC nlohmann_json::nlohmann_json)
Old version¶
CMake API that should be used for versions older than nlohmann_json v3.2.0:
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries(... nlohmann_json)
Very old version¶
CMake API that should be used for nlohmann_json v1.0.0:
hunter_add_package(nlohmann-json)
find_package(nlohmann-json REQUIRED)
target_link_libraries(... nlohmann-json::nlohmann-json)
Related Hunter releases:
migration from v1.0.0 to v2.1.1+¶
- replace all
nlohmann-jsonwithnlohmann_json - add
CONFIGtofind_package(nlohmann_json CONFIG REQUIRED) - shorten
target_link_libraries()totarget_link_libraries(... nlohmann_json)nonlohmann_json::nlohmann_json - change
#include <json.hpp>to#include <nlohmann/json.hpp>