curl: Add CURL_CA_PATH option to CMake build process

Move CMAKE_USE_OPENSSL and CURL_CA_BUNDLE up to the top of CMake so that
CMake's own sources can know their values.  Add the CURL_CA_PATH option
at the top and honor it as part of the curl build.
This commit is contained in:
Brad King 2015-01-21 16:42:18 -05:00
parent c99e19a4ac
commit 6ce346c53c
3 changed files with 11 additions and 11 deletions

View File

@ -287,6 +287,13 @@ macro (CMAKE_BUILD_UTILITIES)
if(CMAKE_TESTS_CDASH_SERVER) if(CMAKE_TESTS_CDASH_SERVER)
set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
endif() endif()
option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF)
mark_as_advanced(CMAKE_USE_OPENSSL)
if(CMAKE_USE_OPENSSL)
set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory")
mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH)
endif()
add_subdirectory(Utilities/cmcurl) add_subdirectory(Utilities/cmcurl)
CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty")
CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty")

View File

@ -425,9 +425,6 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" OFF)
mark_as_advanced(CMAKE_USE_OPENSSL)
set(USE_SSLEAY OFF) set(USE_SSLEAY OFF)
set(USE_OPENSSL OFF) set(USE_OPENSSL OFF)
set(HAVE_LIBCRYPTO OFF) set(HAVE_LIBCRYPTO OFF)
@ -454,11 +451,13 @@ if(CMAKE_USE_OPENSSL)
check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H) check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H)
# Optionally build with a specific CA cert bundle. # Optionally build with a specific CA cert bundle.
set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle")
mark_as_advanced(CURL_CA_BUNDLE)
if(CURL_CA_BUNDLE) if(CURL_CA_BUNDLE)
add_definitions(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") add_definitions(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}")
endif() endif()
# Optionally build with a specific CA cert dir.
if(CURL_CA_PATH)
add_definitions(-DCURL_CA_PATH="${CURL_CA_PATH}")
endif()
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
elseif(WIN32) elseif(WIN32)
# Use Windows SSL/TLS native implementation. # Use Windows SSL/TLS native implementation.

View File

@ -3,12 +3,6 @@
/* when building libcurl itself */ /* when building libcurl itself */
#cmakedefine BUILDING_LIBCURL 1 #cmakedefine BUILDING_LIBCURL 1
/* Location of default ca bundle */
#cmakedefine CURL_CA_BUNDLE ${CURL_CA_BUNDLE}
/* Location of default ca path */
#cmakedefine CURL_CA_PATH ${CURL_CA_PATH}
/* to disable cookies support */ /* to disable cookies support */
#cmakedefine CURL_DISABLE_COOKIES 1 #cmakedefine CURL_DISABLE_COOKIES 1