[PATCH] D111238: [Support][llvm] Add optional libCURL dependency to llvm build configuration

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 13:53:46 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/CMakeLists.txt:407
+  set(LLVM_WITH_CURL 1)
+  set(CURL_LIBRARY "-lcurl")
+  find_package(CURL 7.74.0 REQUIRED)
----------------
noajshu wrote:
> lebedev.ri wrote:
> > This can't be right, shouldn't you be using `CURL_LIBRARIES` set by `find_package()`?
> Thanks, I agree! L407 is needed to avoid the following error which arises if it is removed:
> ```
> CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
>   Could NOT find CURL (missing: CURL_LIBRARY) (found suitable version
>   "7.74.0", minimum required is "7.74.0")
> Call Stack (most recent call first):
>   /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
>   /usr/share/cmake-3.18/Modules/FindCURL.cmake:169 (find_package_handle_standard_args)
>   CMakeLists.txt:407 (find_package)
> 
> 
> -- Configuring incomplete, errors occurred!
> ```
> I tried a few workarounds but setting the `CURL_LIBRARY` was the simplest fix I found. Do you have any idea what might cause this?
I don't know why you are seeing that error, but this should be roughly
```
if (LLVM_ENABLE_DEBUGINFOD_CLIENT)
  set(LLVM_WITH_CURL 1)
  find_package(CURL 7.74.0 REQUIRED)
  add_compile_definitions(
    LLVM_ENABLE_DEBUGINFOD_CLIENT
    LLVM_WITH_CURL)
  # use CURL_LIBRARIES where needed / link to CURL::libcurl imported target.
endif()
```
Anything that hardcodes `-lcurl` is wrong.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111238/new/

https://reviews.llvm.org/D111238



More information about the llvm-commits mailing list