INCLUDE(CheckPrototypeDefinition) # Added in CMake 3.0
INCLUDE(AddCFlagIfSupported)
INCLUDE(FindPkgLibraries)
INCLUDE(FindThreads)
INCLUDE(FindStatNsec)
INCLUDE(GNUInstallDirs)
INCLUDE(IdeSplitSources)
INCLUDE(FeatureSummary)
INCLUDE(EnableWarnings)
# Build options
#
OPTION(SONAME"Set the (SO)VERSION of the target"ON)
OPTION(BUILD_SHARED_LIBS"Build Shared Library (OFF for Static)"ON)
OPTION(THREADSAFE"Build libgit2 as threadsafe"ON)
OPTION(BUILD_CLAR"Build Tests using the Clar suite"ON)
OPTION(BUILD_EXAMPLES"Build library usage example apps"OFF)
OPTION(BUILD_FUZZERS"Build the fuzz targets"OFF)
OPTION(ENABLE_TRACE"Enables tracing support"ON)
OPTION(LIBGIT2_FILENAME"Name of the produced binary"OFF)
OPTION(USE_SSH"Link with libssh2 to enable SSH support"ON)
OPTION(USE_HTTPS"Enable HTTPS support. Can be set to a specific backend"ON)
OPTION(USE_SHA1"Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Generic"ON)
OPTION(USE_GSSAPI"Link with libgssapi for SPNEGO auth"OFF)
OPTION(USE_STANDALONE_FUZZERS"Enable standalone fuzzers (compatible with gcc)"OFF)
OPTION(USE_LEAK_CHECKER"Run tests with leak checker"OFF)
OPTION(DEBUG_POOL"Enable debug pool allocator"OFF)
OPTION(ENABLE_WERROR"Enable compilation with -Werror"OFF)
OPTION(USE_BUNDLED_ZLIB"Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL"OFF)
SET(USE_HTTP_PARSER ""CACHESTRING"Specifies the HTTP Parser implementation; either system or builtin.")
OPTION(DEPRECATE_HARD"Do not include deprecated functions in the library"OFF)
SET(REGEX_BACKEND ""CACHESTRING"Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
IF (UNIX)
IF (NOT USE_HTTPS)
OPTION(USE_NTLMCLIENT"Enable NTLM support on Unix."OFF )
ELSE()
OPTION(USE_NTLMCLIENT"Enable NTLM support on Unix."ON )
OPTION(USE_ICONV"Link with and use iconv library"ON)
ENDIF()
IF(MSVC)
# This option must match the settings used in your program, in particular if you
# are linking statically
OPTION(STATIC_CRT"Link the static CRT libraries"ON)
# If you want to embed a copy of libssh2 into libgit2, pass a
# path to libssh2
OPTION(EMBED_SSH_PATH"Path to libssh2 to embed (Windows)"OFF)
ENDIF()
IF(WIN32)
# By default, libgit2 is built with WinHTTP. To use the built-in
# HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
OPTION(WINHTTP"Use Win32 WinHTTP routines"ON)
ENDIF()
IF(MSVC)
# Enable leak checking using the debugging C runtime.
OPTION(WIN32_LEAKCHECK"Enable leak reporting via crtdbg"OFF)
ENDIF()
IF (DEPRECATE_HARD)
ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
ENDIF()
# Platform specific compilation flags
IF (MSVC)
IF (STDCALL)
MESSAGE(FATAL_ERROR"The STDCALL option is no longer supported; libgit2 is now always built as a cdecl library. If you're using PInvoke, please add the CallingConventions.Cdecl attribute for support.")