Commit c9bb68c2 by Etienne Samson

cmake: move Darwin-specific block around

This allows us to only link against CoreFoundation when using the SecureTransport backend
parent 9980be03
...@@ -56,12 +56,6 @@ IF (UNIX AND NOT APPLE) ...@@ -56,12 +56,6 @@ IF (UNIX AND NOT APPLE)
OPTION( ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF ) OPTION( ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF )
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET( USE_ICONV ON )
FIND_PACKAGE(Security)
FIND_PACKAGE(CoreFoundation REQUIRED)
ENDIF()
IF(MSVC) IF(MSVC)
# This option is only available when building with MSVC. By default, libgit2 # This option is only available when building with MSVC. By default, libgit2
# is build using the cdecl calling convention, which is useful if you're # is build using the cdecl calling convention, which is useful if you're
......
...@@ -97,11 +97,6 @@ IF(THREADSAFE) ...@@ -97,11 +97,6 @@ IF(THREADSAFE)
ENDIF() ENDIF()
ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support") ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support")
IF (COREFOUNDATION_FOUND)
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS})
ENDIF()
IF (WIN32 AND EMBED_SSH_PATH) IF (WIN32 AND EMBED_SSH_PATH)
FILE(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c") FILE(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
...@@ -133,7 +128,7 @@ ELSE () ...@@ -133,7 +128,7 @@ ELSE ()
ENDIF () ENDIF ()
IF (NOT AMIGA AND (USE_HTTPS STREQUAL "OpenSSL" OR USE_HTTPS STREQUAL "ON")) IF (NOT AMIGA AND (USE_HTTPS STREQUAL "OpenSSL" OR USE_HTTPS STREQUAL "ON"))
FIND_PACKAGE(OpenSSL) FIND_PACKAGE(OpenSSL QUIET)
ENDIF () ENDIF ()
IF (CURL_FOUND) IF (CURL_FOUND)
...@@ -147,6 +142,11 @@ ELSE () ...@@ -147,6 +142,11 @@ ELSE ()
ENDIF() ENDIF()
IF (USE_HTTPS) IF (USE_HTTPS)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PACKAGE(Security)
FIND_PACKAGE(CoreFoundation)
ENDIF()
# Auto-select TLS backend # Auto-select TLS backend
IF (USE_HTTPS STREQUAL ON) IF (USE_HTTPS STREQUAL ON)
IF (SECURITY_FOUND) IF (SECURITY_FOUND)
...@@ -168,6 +168,9 @@ IF (USE_HTTPS) ...@@ -168,6 +168,9 @@ IF (USE_HTTPS)
# Check that we can find what's required for the selected backend # Check that we can find what's required for the selected backend
IF (HTTPS_BACKEND STREQUAL "SecureTransport") IF (HTTPS_BACKEND STREQUAL "SecureTransport")
IF (NOT COREFOUNDATION_FOUND)
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found")
ENDIF()
IF (NOT SECURITY_FOUND) IF (NOT SECURITY_FOUND)
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found") MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found")
ENDIF() ENDIF()
...@@ -177,8 +180,8 @@ IF (USE_HTTPS) ...@@ -177,8 +180,8 @@ IF (USE_HTTPS)
SET(GIT_SECURE_TRANSPORT 1) SET(GIT_SECURE_TRANSPORT 1)
LIST(APPEND LIBGIT2_INCLUDES ${SECURITY_INCLUDE_DIR}) LIST(APPEND LIBGIT2_INCLUDES ${SECURITY_INCLUDE_DIR})
LIST(APPEND LIBGIT2_LIBS ${SECURITY_LIBRARIES}) LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES} ${SECURITY_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS ${SECURITY_LDFLAGS}) LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL") ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
IF (NOT OPENSSL_FOUND) IF (NOT OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found") MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
...@@ -303,7 +306,7 @@ ENDIF() ...@@ -303,7 +306,7 @@ ENDIF()
ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support") ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support")
# Optional external dependency: iconv # Optional external dependency: iconv
IF (USE_ICONV) IF (USE_ICONV OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PACKAGE(Iconv) FIND_PACKAGE(Iconv)
ENDIF() ENDIF()
IF (ICONV_FOUND) IF (ICONV_FOUND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment