[Debuginfod] Check libcurl via CMake library.

If libcurl was built with CMake, CMake's FindCURL module defers
completely to the included config file. This config file doesn't set any
of the variables that the current check script depends on; it just sets
up an imported CMake target. Accordingly, the smoke test fails, since it
can't find the libcurl (or its static dependencies).

This changes the compile smoke test to refer to the imported library
instead; this should in turn bring in the necessary include and library
directories via the interface properties set up by CMake. This better
mirrors the way libcurl is referred to elsewhere in the CMakeLists.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D121718
This commit is contained in:
Daniel Thornburgh 2022-03-14 23:23:08 +00:00
parent 687d20de7f
commit 1da2c5ba09
1 changed files with 1 additions and 2 deletions

View File

@ -169,8 +169,7 @@ if(LLVM_ENABLE_CURL)
# Check if curl we found is usable; for example, we may have found a 32-bit
# library on a 64-bit system which would result in a link-time failure.
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARY})
list(APPEND CMAKE_REQUIRED_LIBRARIES CURL::libcurl)
check_symbol_exists(curl_easy_init curl/curl.h HAVE_CURL)
cmake_pop_check_state()
if(LLVM_ENABLE_CURL STREQUAL FORCE_ON AND NOT HAVE_CURL)