1

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)
Command
  • 515
  • 2
  • 6
  • 19

1 Answers1

1

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)

Maxim Banaev
  • 886
  • 1
  • 9
  • 22