How can I add libcurl library in CLion (Windows), step by step? I downloaded .zip from page and right now I have curl-8.9.1 folder. In case someone knows how to add libcurl to vs 2022, it could also help me.
From what I could find I need to add
include_directories(“????”)
target_link_libraries(ProjectName “???”) in CMakeList.txt. Unfortunately in curl-8.9.1 there are many folders there that I don’t know what to do with.
First, I added the directory to the curl-8.9.1 folder to include_directories and directory to folder “lib” in curl-8.9.1. It didn’t work.
Downloading, extracting and other jobs for curl tar.gz can be delegated to cmake, otherwise you would have to care of the curl directory hardcoded location and setting variables for FindPackage.
include(FetchContent)
FetchContent_Declare(curl
URL https://curl.se/download/curl-8.9.1.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP true
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(curl)
find_package(curl REQUIRED)
target_link_libraries(<target> PRIVATE CURL::libcurl)
0