Skip to content

Commit b751455

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

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,9 @@ IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUA
466466
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
467467
ELSE()
468468
MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
469+
ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/deps/http-parser" "${CMAKE_BINARY_DIR}/deps/http-parser")
469470
LIST(APPEND LIBGIT2_INCLUDES "${CMAKE_SOURCE_DIR}/deps/http-parser")
470-
FILE(GLOB SRC_HTTP "${CMAKE_SOURCE_DIR}/deps/http-parser/*.c" "${CMAKE_SOURCE_DIR}/deps/http-parser/*.h")
471+
LIST(APPEND LIBGIT2_LIBS http-parser)
471472
ENDIF()
472473

473474
# Optional external dependency: zlib
@@ -600,7 +601,7 @@ ENDIF()
600601

601602
CONFIGURE_FILE(src/features.h.in git2/sys/features.h)
602603

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

605606
LIST(APPEND LIBGIT2_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/include")
606607

deps/http-parser/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FILE(GLOB SRC_HTTP "*.c" "*.h")
2+
3+
ADD_LIBRARY(http-parser STATIC ${SRC_HTTP})

0 commit comments

Comments
 (0)