Reputation: 523
I want to use (cJSON) library in my c++ code. How do I download and add this library to my CLion project in order to import it into my code like this
#include <cJSON.h>
This is my cMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(a_star_search)
set(CMAKE_CXX_STANDARD 14)
add_executable(a_star_search main.cpp)
Upvotes: 2
Views: 620
Reputation: 926
cJSON is a single file of C, and a single header file. It's enough an add include_directories(<path_to_cjson_directory>)
Or if you are have dynamic library of cJSON you will need to use target_link_libraries(<target_name> cjson)
Upvotes: 1