summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-03-29 22:14:14 +0200
committerEtienne Samson <samson.etienne@gmail.com>2018-04-11 21:02:43 +0200
commit54554757c0595f5b3705f15d1212b34984bb35d1 (patch)
tree1c9e22b102d61a15fd62449dbdd5aeb33d3a4723 /src/CMakeLists.txt
parente3d764a46b41886d8700e6d2c70c7dd33b255f96 (diff)
downloadlibgit2-54554757c0595f5b3705f15d1212b34984bb35d1.tar.gz
cmake: make our preferred backend ordering consistent
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fa86d9fb4..0f5d78547 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -133,6 +133,8 @@ ELSE ()
ENDIF()
IF (USE_HTTPS)
+ # We try to find any packages our backends might use
+ FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(mbedTLS)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PACKAGE(Security)
@@ -150,10 +152,13 @@ IF (USE_HTTPS)
ENDIF()
ELSEIF (WINHTTP)
SET(HTTPS_BACKEND "WinHTTP")
+ ELSEIF(OPENSSL_FOUND)
+ SET(HTTPS_BACKEND "OpenSSL")
ELSEIF(MBEDTLS_FOUND)
SET(HTTPS_BACKEND "mbedTLS")
ELSE()
- SET(HTTPS_BACKEND "OpenSSL")
+ MESSAGE(FATAL_ERROR "Unable to autodetect a usable HTTPS backend."
+ "Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
ENDIF()
ELSE()
# Backend was explicitly set
@@ -177,8 +182,6 @@ IF (USE_HTTPS)
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES} ${SECURITY_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
- FIND_PACKAGE(OpenSSL)
-
IF (NOT OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
ENDIF()