[llvm] 54b35c0 - [Support] [Debuginfod] Use libcurl imported library.

Noah Shutty via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 17:49:41 PST 2021


Author: Noah Shutty
Date: 2021-12-09T01:35:01Z
New Revision: 54b35c09b2cd5e068a9b2f1df461045c732b2807

URL: https://github.com/llvm/llvm-project/commit/54b35c09b2cd5e068a9b2f1df461045c732b2807
DIFF: https://github.com/llvm/llvm-project/commit/54b35c09b2cd5e068a9b2f1df461045c732b2807.diff

LOG: [Support] [Debuginfod] Use libcurl imported library.

A [[ https://lists.llvm.org/pipermail/llvm-dev/2021-December/154203.html | report on llvm-dev ]] indicated that `curl.h` could be found during build configuration but not during compilation. This diff uses the libcurl imported library created by findcurl, so that includes and libs are automatically managed correctly by cmake.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D115189

Added: 
    

Modified: 
    llvm/lib/Debuginfod/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Debuginfod/CMakeLists.txt b/llvm/lib/Debuginfod/CMakeLists.txt
index e2c43e61c39f4..fa02e0456b114 100644
--- a/llvm/lib/Debuginfod/CMakeLists.txt
+++ b/llvm/lib/Debuginfod/CMakeLists.txt
@@ -1,6 +1,6 @@
 # Link LibCURL if the user wants it
 if (LLVM_ENABLE_CURL)
-  set(imported_libs ${CURL_LIBRARIES})
+  set(imported_libs CURL::libcurl)
 endif()
 
 add_llvm_component_library(LLVMDebuginfod
@@ -17,4 +17,17 @@ add_llvm_component_library(LLVMDebuginfod
   Support
   )
 
-set(llvm_system_libs ${system_libs})
+# This block is only needed for llvm-config. When we deprecate llvm-config and
+# move to using CMake export, this block can be removed.
+if(LLVM_ENABLE_CURL)
+  # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
+  if(CMAKE_BUILD_TYPE)
+    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
+    get_property(curl_library TARGET CURL::libcurl PROPERTY LOCATION_${build_type})
+  endif()
+  if(NOT curl_library)
+    get_property(curl_library TARGET CURL::libcurl PROPERTY LOCATION)
+  endif()
+  get_library_name(${curl_library} curl_library)
+  set(llvm_system_libs ${llvm_system_libs} "${curl_library}")
+endif()


        


More information about the llvm-commits mailing list