Skip to content

Commit dcf81cd

Browse files
committed
deprecation: optionally enable hard deprecation
Add a CMake option to enable hard deprecation; the resultant library will _not_ include any deprecated functions. This may be useful for internal CI builds that create libraries that are not shared with end-users to ensure that we do not use deprecated bits internally.
1 parent 24ac9e0 commit dcf81cd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ OPTION(USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
6464
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
6565
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
6666
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
67+
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
6768

6869
IF (UNIX AND NOT APPLE)
6970
OPTION(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
@@ -105,6 +106,10 @@ SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${
105106
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
106107
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
107108

109+
IF (DEPRECATE_HARD)
110+
ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
111+
ENDIF()
112+
108113
# Platform specific compilation flags
109114
IF (MSVC)
110115
IF (STDCALL)

0 commit comments

Comments
 (0)