From e325a384a37c82de7cac87856787fe43b24a3590 Mon Sep 17 00:00:00 2001
From: Jakub Zakrzewski <jzakrzewski@e2ebridge.com>
Date: Wed, 30 Jul 2014 17:24:47 +0200
Subject: [PATCH 02/13] Cmake: Require at least CMake 2.8.

CMake 2.6 is already a bit old. Many bugs have been fixed since
its release. We use 2.8 in our company and we have no intention
of polluting our environment with old software, so 2.6 would
not be tested. This shouldn't be a problem since all one need
to build CMake from source is C and C++ compiler.
---
 CMake/FindOpenSSL.cmake |   21 ---------------------
 CMake/FindZLIB.cmake    |   10 ----------
 CMakeLists.txt          |   14 +++++++-------
 3 files changed, 7 insertions(+), 38 deletions(-)
 delete mode 100644 CMake/FindOpenSSL.cmake
 delete mode 100644 CMake/FindZLIB.cmake

diff --git a/CMake/FindOpenSSL.cmake b/CMake/FindOpenSSL.cmake
deleted file mode 100644
index 279428b..0000000
--- a/CMake/FindOpenSSL.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# Extension of the standard FindOpenSSL.cmake
-# Adds OPENSSL_INCLUDE_DIRS and libeay32
-include("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake")
-
-# starting 2.8 it is better to use standard modules
-if(CMAKE_MAJOR_VERSION EQUAL "2" AND CMAKE_MINOR_VERSION LESS "8")
-  # Bill Hoffman told that libeay32 is necessary for him:
-  find_library(SSL_LIBEAY NAMES libeay32)
-
-  if(OPENSSL_FOUND)
-    if(SSL_LIBEAY)
-      list(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY})
-    else()
-      set(OPENSSL_FOUND FALSE)
-    endif()
-  endif()
-endif() # if (CMAKE_MAJOR_VERSION EQUAL "2" AND CMAKE_MINOR_VERSION LESS "8")
-
-if(OPENSSL_FOUND)
-  set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
-endif()
diff --git a/CMake/FindZLIB.cmake b/CMake/FindZLIB.cmake
deleted file mode 100644
index b2cfe18..0000000
--- a/CMake/FindZLIB.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-# Locate zlib
-include("${CMAKE_ROOT}/Modules/FindZLIB.cmake")
-
-# starting 2.8 it is better to use standard modules
-if(CMAKE_MAJOR_VERSION EQUAL "2" AND CMAKE_MINOR_VERSION LESS "8")
-  find_library(ZLIB_LIBRARY_DEBUG NAMES zd zlibd zdlld zlib1d )
-  if(ZLIB_FOUND AND ZLIB_LIBRARY_DEBUG)
-    set( ZLIB_LIBRARIES optimized "${ZLIB_LIBRARY}" debug ${ZLIB_LIBRARY_DEBUG})
-  endif()
-endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ef9b68..0276a27 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@
 # To check:
 # (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not.
 # (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options.
-cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
 include(Utilities)
 
@@ -248,7 +248,7 @@ 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)
-if(CURL_ZLIB)  # AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE
+if(CURL_ZLIB)
   find_package(ZLIB QUIET)
   if(ZLIB_FOUND)
     set(HAVE_ZLIB_H ON)
@@ -260,13 +260,13 @@ endif()
 
 option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
 mark_as_advanced(CMAKE_USE_OPENSSL)
-if(CMAKE_USE_OPENSSL)
 
-  set(USE_SSLEAY OFF)
-  set(USE_OPENSSL OFF)
-  set(HAVE_LIBCRYPTO OFF)
-  set(HAVE_LIBSSL OFF)
+set(USE_SSLEAY OFF)
+set(USE_OPENSSL OFF)
+set(HAVE_LIBCRYPTO OFF)
+set(HAVE_LIBSSL OFF)
 
+if(CMAKE_USE_OPENSSL)
   find_package(OpenSSL)
   if(OPENSSL_FOUND)
     list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
-- 
1.7.7

