]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Create ENABLE_OPENSSL CMake option
authorBrad King <brad.king@kitware.com>
Wed, 16 Dec 2009 13:32:27 +0000 (08:32 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 16 Dec 2009 13:32:27 +0000 (08:32 -0500)
This option tells libarchive whether to check for OpenSSL and use it.
We enable it by default since we previously did this unconditionally.
This provides the CMake equivalent to the --without-openssl option,
spelled as -DENABLE_OPENSSL=OFF.  See issue #22.

SVN-Revision: 1750

CMakeLists.txt

index 059df17dfff48545c9dbc7e3be70835972eca3de..a19391b2ffa1a0c8e5ca6fa6117d364b223deadc 100644 (file)
@@ -35,6 +35,7 @@ include(CTest)
 # TODO: Require CMake 2.8 and drop this workaround (perhaps late 2010).
 INCLUDE(AddTest28)
 
+OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
 OPTION(ENABLE_TAR "Enable tar building" ON)
 OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" OFF)
 OPTION(ENABLE_CPIO "Enable cpio building" ON)
@@ -259,11 +260,23 @@ LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
 #
 # Find OpenSSL
 #
-FIND_PACKAGE(OpenSSL)
+IF(ENABLE_OPENSSL)
+  FIND_PACKAGE(OpenSSL)
+ELSE()
+  SET(OPENSSL_FOUND 0)
+ENDIF()
 IF(OPENSSL_FOUND)
   INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
   LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
-ENDIF(OPENSSL_FOUND)
+ELSE()
+  # Block OpenSSL checks and override cached results.
+  SET(HAVE_OPENSSL_MD5_H 0)
+  SET(HAVE_OPENSSL_RIPEMD_H 0)
+  SET(HAVE_OPENSSL_SHA_H 0)
+  SET(HAVE_OPENSSL_SHA256_INIT 0)
+  SET(HAVE_OPENSSL_SHA384_INIT 0)
+  SET(HAVE_OPENSSL_SHA512_INIT 0)
+ENDIF()
 #
 # Check MD5/RMD160/SHA headers
 #