I am using the following JSON parser: https://github.com/nlohmann/json
Following is the steps I followed to build :
2074 git clone https://github.com/nlohmann/json.git
2075 git branch
2076 ls
2077 cd json/
2078 git branch
2079 git pull
2080 ls
2081 vi CODE_OF_CONDUCT.md
2082 mkdir build
2083 cd build/
2084 ls
2085 cmake ..
2086 cmake --build .
2087 ctest --output-on-failure
The unit tests pass. I do not see the library being built, as the documentation mentions.
I am trying to build a simple hello world program for the parser. Here is the code:
#include <nlohmann/json.hpp>
#include<string.h>
// for convenience
using json = nlohmann::json;
int
main(int argc, char *argv[])
{
std::ifstream ifs("test.json");
json jf = json::parse(ifs);
return 0;
}
And the CMake file:
# CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
# set the project name
project(my_json CXX)
find_package(nlohmann_json 3.2.0 REQUIRED)
However, CMake cannot find the package nlohmann_json.
Please suggest how to build this example. I am planning to use the external library method to build this code.