jpbarrette/curlpp

Build error (cannot find curl)

arietto opened this issue · 4 comments

I use C++, curl 7.64, CMake 3.19.3, curlpp 0.8.1, Windows 7 OS. I cannot build curlpp out-of-the-box. CURL_FOUND is set to true, but CURL_INCLUDE_DIRS and CURL_LIBRARIES are empty (AFAIK, CMake module delegates variables filling to curl CMake module).

I've set CURL_INCLUDE_DIRS manually, but setting CURL_LIBRARIES="debug "path_to_debug" optimized "path_to_release"" fails. So, I've got linker errors.

BTW, why do some curl-consuming CMakeLists.txt files use ${CURL_LIBRARIES} and the other ones use CURL::libcurl for feeding target_link_libraries?
I suppose that curlpp uses obsolete way to connect to curl.
P.S. When I switched to CURL::libcurl, then the build was successful. AFAIK, CURL_INCLUDE_DIRS becomes redundant in that mode.

Hi,

did you try to just set CURL_LIBRARY to libcurl :

set(CURL_LIBRARY libcurl)

Where should I put this command? I've tried to set it as a command line argument (-DCURL_LIBRARY=libcurl) for curlpp, but build failed. Putting set(CURL_LIBRARY libcurl) to the top of curlpp CMakeLists.txt did not help either.

I put it in the CMakeLists.txt of my project, before to call add_subdirectory on the curlpp directory. Here is part of my CMakeLists.txt :

set(CURL_INCLUDE_DIR ${CURL_SOURCE_DIR}/include)
set(CURL_LIBRARY libcurl)
set(CURLPP_BUILD_SHARED_LIBS OFF)
add_subdirectory(curlpp-0.8.1)

As I use static build, my app need to be linked to libcurl and curlpp_static.

Thank you. But what if somebody wants to build dynamic library? I don't understand why manual patching of CMakeLists.txt is required. curlpp should be built out-of-the-box.