Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error (cannot find curl) #116

Open
arietto opened this issue Jan 20, 2021 · 4 comments
Open

Build error (cannot find curl) #116

arietto opened this issue Jan 20, 2021 · 4 comments

Comments

@arietto
Copy link

arietto commented Jan 20, 2021

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.

@sgallou
Copy link
Collaborator

sgallou commented Jan 20, 2021

Hi,

did you try to just set CURL_LIBRARY to libcurl :

set(CURL_LIBRARY libcurl)

@arietto
Copy link
Author

arietto commented Jan 20, 2021

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.

@sgallou
Copy link
Collaborator

sgallou commented Jan 20, 2021

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.

@arietto
Copy link
Author

arietto commented Jan 20, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants