From a4de1ae38980ea52d675d52d60d19f1bec61c127 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 25 Apr 2017 10:14:19 +0200 Subject: cmake: define GIT_HTTPS when HTTPS is supported --- CMakeLists.txt | 3 +++ src/settings.c | 2 +- tests/online/badssl.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5bf21f54..ca52db79c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,6 +238,7 @@ ENDIF() IF (WIN32 AND WINHTTP) ADD_DEFINITIONS(-DGIT_WINHTTP) + ADD_DEFINITIONS(-DGIT_HTTPS) # Since MinGW does not come with headers or an import library for winhttp, # we have to include a private header and generate our own import library @@ -546,11 +547,13 @@ ENDIF() IF (SECURITY_FOUND) ADD_DEFINITIONS(-DGIT_SECURE_TRANSPORT) + ADD_DEFINITIONS(-DGIT_HTTPS) INCLUDE_DIRECTORIES(${SECURITY_INCLUDE_DIR}) ENDIF () IF (OPENSSL_FOUND) ADD_DEFINITIONS(-DGIT_OPENSSL) + ADD_DEFINITIONS(-DGIT_HTTPS) INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES}) ENDIF() diff --git a/src/settings.c b/src/settings.c index 07ac16a8f..42f247aae 100644 --- a/src/settings.c +++ b/src/settings.c @@ -31,7 +31,7 @@ int git_libgit2_features(void) #ifdef GIT_THREADS | GIT_FEATURE_THREADS #endif -#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) +#ifdef GIT_HTTPS | GIT_FEATURE_HTTPS #endif #if defined(GIT_SSH) diff --git a/tests/online/badssl.c b/tests/online/badssl.c index aa4c24d9c..6524fcd8e 100644 --- a/tests/online/badssl.c +++ b/tests/online/badssl.c @@ -4,7 +4,7 @@ static git_repository *g_repo; -#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) +#ifdef GIT_HTTPS static bool g_has_ssl = true; #else static bool g_has_ssl = false; -- cgit v1.2.1 From 417319cc86e1bc7a89f6ab00443448a4d034c3bc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 25 Apr 2017 10:14:37 +0200 Subject: tests: core::features: only check for HTTPS if it is supported --- tests/core/features.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/core/features.c b/tests/core/features.c index cf5e19063..7b28cc0cb 100644 --- a/tests/core/features.c +++ b/tests/core/features.c @@ -17,7 +17,9 @@ void test_core_features__0(void) cl_assert((caps & GIT_FEATURE_THREADS) == 0); #endif +#ifdef GIT_HTTPS cl_assert((caps & GIT_FEATURE_HTTPS) != 0); +#endif #if defined(GIT_SSH) cl_assert((caps & GIT_FEATURE_SSH) != 0); -- cgit v1.2.1