11IF (DEBUG_POOL)
22 SET (GIT_DEBUG_POOL 1)
33ENDIF ()
4+ ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator" )
45
56# Add the features.h file as a dummy. This is required for Xcode
67# to successfully build the libgit2 library when using only
@@ -50,6 +51,7 @@ ENDIF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
5051IF (ENABLE_TRACE STREQUAL "ON" )
5152 SET (GIT_TRACE 1)
5253ENDIF ()
54+ ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support" )
5355
5456CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
5557IF (HAVE_REGCOMP_L)
@@ -93,26 +95,7 @@ IF(THREADSAFE)
9395 LIST (APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT} )
9496 LIST (APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT} )
9597ENDIF ()
96-
97- IF (SECURITY_FOUND)
98- # OS X 10.7 and older do not have some functions we use, fall back to OpenSSL there
99- CHECK_LIBRARY_EXISTS("${SECURITY_DIRS} " SSLCreateContext "Security/SecureTransport.h" HAVE_NEWER_SECURITY)
100- IF (HAVE_NEWER_SECURITY)
101- MESSAGE ("-- Found Security ${SECURITY_DIRS} " )
102- LIST (APPEND LIBGIT2_PC_LIBS "-framework Security" )
103- LIST (APPEND LIBGIT2_LIBS ${SECURITY_DIRS} )
104- ELSE ()
105- MESSAGE ("-- Security framework is too old, falling back to OpenSSL" )
106- SET (SECURITY_FOUND "NO" )
107- SET (USE_OPENSSL "ON" )
108- ENDIF ()
109- ENDIF ()
110-
111- IF (COREFOUNDATION_FOUND)
112- MESSAGE ("-- Found CoreFoundation ${COREFOUNDATION_DIRS} " )
113- LIST (APPEND LIBGIT2_PC_LIBS "-framework CoreFoundation" )
114- LIST (APPEND LIBGIT2_LIBS ${COREFOUNDATION_DIRS} )
115- ENDIF ()
98+ ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support" )
11699
117100
118101IF (WIN32 AND EMBED_SSH_PATH)
@@ -124,7 +107,6 @@ ENDIF()
124107
125108IF (WIN32 AND WINHTTP)
126109 SET (GIT_WINHTTP 1)
127- SET (GIT_HTTPS 1)
128110
129111 # Since MinGW does not come with headers or an import library for winhttp,
130112 # we have to include a private header and generate our own import library
@@ -145,8 +127,8 @@ ELSE ()
145127 PKG_CHECK_MODULES(CURL libcurl)
146128 ENDIF ()
147129
148- IF (NOT AMIGA AND USE_OPENSSL )
149- FIND_PACKAGE (OpenSSL)
130+ IF (NOT AMIGA AND (USE_HTTPS STREQUAL "OpenSSL" OR USE_HTTPS STREQUAL "ON" ) )
131+ FIND_PACKAGE (OpenSSL QUIET )
150132 ENDIF ()
151133
152134 IF (CURL_FOUND)
@@ -156,28 +138,96 @@ ELSE ()
156138 LIST (APPEND LIBGIT2_LIBS ${CURL_LIBRARIES} )
157139 LIST (APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS} )
158140 ENDIF ()
141+ ADD_FEATURE_INFO(cURL GIT_CURL "cURL for HTTP proxy support" )
142+ ENDIF ()
143+
144+ IF (USE_HTTPS)
145+ IF (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
146+ FIND_PACKAGE (Security)
147+ FIND_PACKAGE (CoreFoundation)
148+ ENDIF ()
149+
150+ # Auto-select TLS backend
151+ IF (USE_HTTPS STREQUAL ON )
152+ IF (SECURITY_FOUND)
153+ IF (SECURITY_HAS_SSLCREATECONTEXT)
154+ SET (HTTPS_BACKEND "SecureTransport" )
155+ ELSE ()
156+ MESSAGE ("-- Security framework is too old, falling back to OpenSSL" )
157+ SET (HTTPS_BACKEND "OpenSSL" )
158+ ENDIF ()
159+ ELSEIF (WINHTTP)
160+ SET (HTTPS_BACKEND "WinHTTP" )
161+ ELSE ()
162+ SET (HTTPS_BACKEND "OpenSSL" )
163+ ENDIF ()
164+ ELSE ()
165+ # Backend was explicitly set
166+ SET (HTTPS_BACKEND ${USE_HTTPS} )
167+ ENDIF ()
168+
169+ # Check that we can find what's required for the selected backend
170+ IF (HTTPS_BACKEND STREQUAL "SecureTransport" )
171+ IF (NOT COREFOUNDATION_FOUND)
172+ MESSAGE (FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found" )
173+ ENDIF ()
174+ IF (NOT SECURITY_FOUND)
175+ MESSAGE (FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found" )
176+ ENDIF ()
177+ IF (NOT SECURITY_HAS_SSLCREATECONTEXT)
178+ MESSAGE (FATAL_ERROR "Cannot use SecureTransport backend, SSLCreateContext not supported" )
179+ ENDIF ()
180+
181+ SET (GIT_SECURE_TRANSPORT 1)
182+ LIST (APPEND LIBGIT2_INCLUDES ${SECURITY_INCLUDE_DIR} )
183+ LIST (APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES} ${SECURITY_LIBRARIES} )
184+ LIST (APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS} )
185+ ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL" )
186+ IF (NOT OPENSSL_FOUND)
187+ MESSAGE (FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found" )
188+ ENDIF ()
189+
190+ SET (GIT_OPENSSL 1)
191+ LIST (APPEND LIBGIT2_INCLUDES ${OPENSSL_INCLUDE_DIR} )
192+ LIST (APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES} )
193+ LIST (APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS} )
194+ ELSEIF (HTTPS_BACKEND STREQUAL "WinHTTP" )
195+ # WinHTTP setup was handled in the WinHTTP-specific block above
196+ ELSE ()
197+ MESSAGE (FATAL_ERROR "Asked for backend ${HTTPS_BACKEND} but it wasn't found" )
198+ ENDIF ()
199+
200+ ADD_FEATURE_INFO(HTTPS ON "using ${HTTPS_BACKEND} " )
201+ SET (GIT_HTTPS 1)
202+ ELSE ()
203+ ADD_FEATURE_INFO(HTTPS OFF "no support" )
159204ENDIF ()
160205
161206# Specify sha1 implementation
162207IF (USE_SHA1DC)
208+ ADD_FEATURE_INFO(SHA ON "using SHA1DC" )
163209 SET (GIT_SHA1_COLLISIONDETECT 1)
164210 ADD_DEFINITIONS (-DSHA1DC_NO_STANDARD_INCLUDES=1)
165211 ADD_DEFINITIONS (-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
166212 ADD_DEFINITIONS (-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
167213 FILE (GLOB SRC_SHA1 hash/hash_collisiondetect.c hash/sha1dc/*)
168214ELSEIF (WIN32 AND NOT MINGW)
215+ ADD_FEATURE_INFO(SHA ON "using SHA1_WIN32" )
169216 SET (GIT_SHA1_WIN32 1)
170217 FILE (GLOB SRC_SHA1 hash/hash_win32.c)
171218ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
219+ ADD_FEATURE_INFO(SHA ON "using CommonCrypto" )
172220 SET (GIT_SHA1_COMMON_CRYPTO 1)
173221ELSEIF (OPENSSL_FOUND)
222+ ADD_FEATURE_INFO(SHA ON "using OpenSSL" )
174223 SET (GIT_SHA1_OPENSSL 1)
175224 IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
176225 LIST (APPEND LIBGIT2_PC_LIBS "-lssl" )
177226 ELSE ()
178227 SET (LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl" )
179228 ENDIF ()
180229ELSE ()
230+ ADD_FEATURE_INFO(SHA ON "using generic" )
181231 FILE (GLOB SRC_SHA1 hash/hash_generic.c)
182232ENDIF ()
183233
@@ -195,11 +245,13 @@ IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUA
195245 LIST (APPEND LIBGIT2_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS} )
196246 LIST (APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES} )
197247 LIST (APPEND LIBGIT2_PC_LIBS "-lhttp_parser" )
248+ ADD_FEATURE_INFO(http-parser ON "http-parser support" )
198249ELSE ()
199250 MESSAGE (STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources." )
200251 ADD_SUBDIRECTORY ("${libgit2_SOURCE_DIR} /deps/http-parser" "${libgit2_BINARY_DIR} /deps/http-parser" )
201252 LIST (APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR} /deps/http-parser" )
202253 LIST (APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>" )
254+ ADD_FEATURE_INFO(http-parser ON "http-parser support (bundled)" )
203255ENDIF ()
204256
205257# Optional external dependency: zlib
@@ -213,11 +265,13 @@ IF (ZLIB_FOUND)
213265 ELSE ()
214266 SET (LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib" )
215267 ENDIF ()
268+ ADD_FEATURE_INFO(zlib ON "Zlib support" )
216269ELSE ()
217270 MESSAGE (STATUS "zlib was not found; using bundled 3rd-party sources." )
218271 ADD_SUBDIRECTORY ("${libgit2_SOURCE_DIR} /deps/zlib" "${libgit2_BINARY_DIR} /deps/zlib" )
219272 LIST (APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR} /deps/zlib" )
220273 LIST (APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
274+ ADD_FEATURE_INFO(zlib ON "Zlib support (bundled)" )
221275ENDIF ()
222276
223277# Optional external dependency: libssh2
@@ -239,6 +293,7 @@ IF (LIBSSH2_FOUND)
239293ELSE ()
240294 MESSAGE (STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path." )
241295ENDIF ()
296+ ADD_FEATURE_INFO(SSH GIT_SSH "SSH transport support" )
242297
243298# Optional external dependency: libgssapi
244299IF (USE_GSSAPI)
@@ -248,9 +303,10 @@ IF (GSSAPI_FOUND)
248303 SET (GIT_GSSAPI 1)
249304 LIST (APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES} )
250305ENDIF ()
306+ ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support" )
251307
252308# Optional external dependency: iconv
253- IF (USE_ICONV)
309+ IF (USE_ICONV OR CMAKE_SYSTEM_NAME MATCHES "Darwin" )
254310 FIND_PACKAGE (Iconv)
255311ENDIF ()
256312IF (ICONV_FOUND)
@@ -259,20 +315,7 @@ IF (ICONV_FOUND)
259315 LIST (APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES} )
260316 LIST (APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES} )
261317ENDIF ()
262-
263- IF (SECURITY_FOUND)
264- SET (GIT_SECURE_TRANSPORT 1)
265- SET (GIT_HTTPS 1)
266- LIST (APPEND LIBGIT2_INCLUDES ${SECURITY_INCLUDE_DIR} )
267- ENDIF ()
268-
269- IF (OPENSSL_FOUND)
270- SET (GIT_OPENSSL 1)
271- SET (GIT_HTTPS 1)
272- LIST (APPEND LIBGIT2_INCLUDES ${OPENSSL_INCLUDE_DIR} )
273- LIST (APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES} )
274- ENDIF ()
275-
318+ ADD_FEATURE_INFO(iconv GIT_USE_ICONV "iconv encoding conversion support" )
276319
277320
278321IF (THREADSAFE)
@@ -320,7 +363,10 @@ ELSE()
320363 ENDIF ()
321364 FILE (GLOB SRC_OS unix /*.c unix /*.h)
322365ENDIF ()
323- FILE (GLOB SRC_GIT2 *.c *.h transports/*.c transports/*.h xdiff/*.c xdiff/*.h)
366+ FILE (GLOB SRC_GIT2 *.c *.h
367+ streams/*.c streams/*.h
368+ transports/*.c transports/*.h
369+ xdiff/*.c xdiff/*.h)
324370
325371# Determine architecture of the machine
326372IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
0 commit comments