]> granicus.if.org Git - curl/commitdiff
cmake: uniform ZLIB to use USE_ variable and clean curl-config.cmake.in
authorTuomo Rinne <me@tuomo.co.uk>
Sat, 27 Oct 2018 10:23:19 +0000 (11:23 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 29 Oct 2018 16:10:31 +0000 (17:10 +0100)
Closes #3123

CMake/curl-config.cmake.in
CMakeLists.txt

index 5f296343e1e0d62bd9ce175a254cc55d6ef06b92..1294e173a009afbfb19a81f742fe5bd27510e3aa 100644 (file)
@@ -1,15 +1,12 @@
 @PACKAGE_INIT@
 
-if("@USE_OPENSSL@" OR "@CURL_ZLIB@" )
-    include(CMakeFindDependencyMacro)
-    if ("@USE_OPENSSL@")
-        find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@")
-    endif()
-    if("@CURL_ZLIB@")
-       find_dependency(ZLIB "@ZLIB_VERSION_MAJOR@")
-    endif()
+include(CMakeFindDependencyMacro)
+if(@USE_OPENSSL@)
+  find_dependency(OpenSSL @OPENSSL_VERSION_MAJOR@)
+endif()
+if(@USE_ZLIB@)
+  find_dependency(ZLIB @ZLIB_VERSION_MAJOR@)
 endif()
-
 
 include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
 check_required_components("@PROJECT_NAME@")
index 0478ae17959c3bf95754261993a4c932bee8ee2d..d7ad6caa169d0bfadaecaf17986a9150f3ddaaf8 100644 (file)
@@ -508,13 +508,13 @@ check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN)
 option(CURL_ZLIB "Set to ON to enable building curl with zlib support." ON)
 set(HAVE_LIBZ OFF)
 set(HAVE_ZLIB_H OFF)
-set(HAVE_ZLIB OFF)
+set(USE_ZLIB OFF)
 if(CURL_ZLIB)
   find_package(ZLIB QUIET)
   if(ZLIB_FOUND)
     set(HAVE_ZLIB_H ON)
-    set(HAVE_ZLIB ON)
     set(HAVE_LIBZ ON)
+    set(USE_ZLIB ON)
 
     # Depend on ZLIB via imported targets if supported by the running
     # version of CMake.  This allows our dependents to get our dependencies