This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 5c610bf40543feca7ed934e9fe1ebbbcccd6c265
Author: Alexey Serbin <[email protected]>
AuthorDate: Thu Feb 6 23:26:52 2020 -0800

    [util] use libcurl from thirdparty
    
    Since libcurl is now used not only as a build-time dependency, but
    as run-time dependency as well (for cloud type detection), let's make
    sure we linked in the curl library that's built in thirdparty and not
    from somewhere else.
    
    Change-Id: I5448829cb4fa1b3dfc05ab0dfbd9b4a73b7f837e
    Reviewed-on: http://gerrit.cloudera.org:8080/15180
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <[email protected]>
---
 CMakeLists.txt               |  4 ++++
 cmake_modules/FindCURL.cmake | 31 +++++++++++++++++++++++++++++++
 src/kudu/util/CMakeLists.txt |  2 +-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8df04a8..4852891 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1067,6 +1067,10 @@ endif()
 
 ## curl
 find_package(CURL REQUIRED)
+include_directories(SYSTEM ${CURL_INCLUDE_DIR})
+ADD_THIRDPARTY_LIB(curl
+  STATIC_LIB "${CURL_STATIC_LIB}"
+  SHARED_LIB "${CURL_SHARED_LIB}")
 
 ## crcutil
 find_package(Crcutil REQUIRED)
diff --git a/cmake_modules/FindCURL.cmake b/cmake_modules/FindCURL.cmake
new file mode 100644
index 0000000..124ea64
--- /dev/null
+++ b/cmake_modules/FindCURL.cmake
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+find_path(CURL_INCLUDE_DIR curl/curl.h
+  # Don't accidentally pick up CURL elsewhere (i.e. somewhere not in 
thirdparty)
+  NO_CMAKE_SYSTEM_PATH
+  NO_SYSTEM_ENVIRONMENT_PATH)
+find_library(CURL_STATIC_LIB libcurl.a
+  NO_CMAKE_SYSTEM_PATH
+  NO_SYSTEM_ENVIRONMENT_PATH)
+find_library(CURL_SHARED_LIB curl
+  NO_CMAKE_SYSTEM_PATH
+  NO_SYSTEM_ENVIRONMENT_PATH)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CURL REQUIRED_VARS
+  CURL_STATIC_LIB CURL_SHARED_LIB CURL_INCLUDE_DIR)
diff --git a/src/kudu/util/CMakeLists.txt b/src/kudu/util/CMakeLists.txt
index 4c576bb..a67fc3e 100644
--- a/src/kudu/util/CMakeLists.txt
+++ b/src/kudu/util/CMakeLists.txt
@@ -329,7 +329,7 @@ add_library(kudu_curl_util
   curl_util.cc)
 target_link_libraries(kudu_curl_util
   security
-  ${CURL_LIBRARIES}
+  curl
   glog
   gutil)
 

Reply via email to