简体   繁体   中英

How to add an open source library to CLion in a Mac?

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)

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM