Adding Curl library with Fetchcontent

You are absolutely right, and I actually observed the same thing. I was simply exhausted and opted not to delve into details that wouldn’t have mattered at the time. Nevertheless, I appreciate your input.


I attempted to implement your solution, but unfortunately, I encountered the same error indicating that it couldn’t locate the file or directory named (curl/curl.h). Here is the code I used:


FetchContent_Declare(curl
	URL https://curl.se/download/curl-8.5.0.tar.gz
	DOWNLOAD_EXTRACT_TIMESTAMP true
	OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(curl)

find_package(curl)

target_link_libraries(${EXECUTABLE_NAME}
	INTERFACE
	CURL::libcurl CURL::curl
)

Please note that I modified the keyword from PRIVATE to INTERFACE because I’m unable to directly link against an executable with PRIVATE.