From 37941121082ee88488b76c7be33facbf0930c5f9 Mon Sep 17 00:00:00 2001 From: bsergean Date: Tue, 24 Jan 2023 19:08:52 -0800 Subject: [PATCH] CMake: Check whether libcurl was already found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently when there is any other project that brings libcurl as a dependency, the build fails with “Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)“, even though libcurl has already added as CURL::libcurl library. This patch adds a check for CURL_FOUND, to indicate that the library was already found, if set by another project. It also skips the additional find_package() step so it does not fail. --- util/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 9789ce58b..311b801f6 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -246,7 +246,10 @@ endif() if(LINUX OR ANDROID) if (LINUX) - find_package(CURL REQUIRED) + if(NOT CURL_FOUND) # Some other lib might bring libcurl already + find_package(CURL REQUIRED) + endif() + target_include_directories(crashpad_util PRIVATE ${CURL_INCLUDE_DIRS}) target_link_libraries(crashpad_util PRIVATE ${CURL_LIBRARIES}) SET(HTTP_TRANSPORT_IMPL net/http_transport_libcurl.cc)