8000 cmake: move zlib build instructions into subdirectory · libgit2/libgit2@1f43a43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f43a43

Browse files
committed
cmake: move zlib build instructions into subdirectory
Extract code required to build the zlib library into its own CMakeLists.txt, which is included as required.
1 parent b751455 commit 1f43a43

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,9 @@ IF (ZLIB_FOUND)
484484
ENDIF()
485485
ELSE()
486486
MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
487+
ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/deps/zlib" "${CMAKE_BINARY_DIR}/deps/zlib")
487488
LIST(APPEND LIBGIT2_INCLUDES "${CMAKE_SOURCE_DIR}/deps/zlib")
488-
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
489-
FILE(GLOB SRC_ZLIB "${CMAKE_SOURCE_DIR}/deps/zlib/*.c" "${CMAKE_SOURCE_DIR}/deps/zlib/*.h")
489+
LIST(APPEND LIBGIT2_LIBS zlib)
490490
ENDIF()
491491

492492
# Optional external dependency: libssh2
@@ -601,7 +601,7 @@ ENDIF()
601601

602602
CONFIGURE_FILE(src/features.h.in git2/sys/features.h)
603603

604-
SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_SSH} ${SRC_SHA1})
604+
SET(GIT2INTERNAL_OBJECTS ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1})
605605

606606
LIST(APPEND LIBGIT2_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include")
607607

deps/zlib/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
2+
FILE(GLOB SRC_ZLIB "*.c" "*.h")
3+
INCLUDE_DIRECTORIES(".")
4+
ADD_LIBRARY(zlib STATIC ${SRC_ZLIB})

0 commit comments

Comments
 (0)
0