CMakeLists.txt (824B)
1 cmake_minimum_required(VERSION 3.5) 2 project(search) 3 4 include_directories("include") 5 6 include(FetchContent) 7 FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git 8 GIT_TAG 53e2d28696e542d4b32b7c42928395494bcafe64) # Replace with your desired git commit from: https://github.com/libcpr/cpr/releases 9 FetchContent_MakeAvailable(cpr) 10 11 12 option(CURL_STATIC_LINKING "Set to ON to build libcurl with static linking." OFF) 13 14 if(CURL_STATIC_LINKING) 15 message("-DCURL_STATICLIB [added]") 16 add_definitions(-DCURL_STATICLIB) 17 endif() 18 19 add_definitions(-DJSON_USE_IMPLICIT_CONVERSIONS=0) 20 find_package(CURL REQUIRED) 21 include_directories(${CURL_INCLUDE_DIRS}) 22 23 add_executable(main src/main.cpp) 24 target_link_libraries(main PRIVATE ${CURL_LIBRARIES}) 25 target_link_libraries(main PRIVATE cpr::cpr)