@@ -237,8 +237,6 @@ ENDIF()
237237
238238IF (WIN32 AND WINHTTP)
239239 ADD_DEFINITIONS (-DGIT_WINHTTP)
240- INCLUDE_DIRECTORIES (deps/http-parser)
241- FILE (GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
242240
243241 # Since MinGW does not come with headers or an import library for winhttp,
244242 # we have to include a private header and generate our own import library
@@ -291,17 +289,6 @@ ELSE ()
291289 LINK_LIBRARIES (${CURL_LIBRARIES} )
292290 LIST (APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS} )
293291 ENDIF ()
294-
295- FIND_PACKAGE (HTTP_Parser)
296- IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
297- INCLUDE_DIRECTORIES (${HTTP_PARSER_INCLUDE_DIRS} )
298- LINK_LIBRARIES (${HTTP_PARSER_LIBRARIES} )
299- LIST (APPEND LIBGIT2_PC_LIBS "-lhttp_parser" )
300- ELSE ()
301- MESSAGE (STATUS "http-parser was not found or is too old; using bundled 3rd-party sources." )
302- INCLUDE_DIRECTORIES (deps/http-parser)
303- FILE (GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
304- ENDIF ()
305292ENDIF ()
306293
307294# Specify sha1 implementation
@@ -332,6 +319,18 @@ IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
332319 SET (SRC_REGEX deps/regex /regex .c)
333320ENDIF ()
334321
322+ # Optional external dependency: http-parser
323+ FIND_PACKAGE (HTTP_Parser)
324+ IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
325+ INCLUDE_DIRECTORIES (${HTTP_PARSER_INCLUDE_DIRS} )
326+ LINK_LIBRARIES (${HTTP_PARSER_LIBRARIES} )
327+ LIST (APPEND LIBGIT2_PC_LIBS "-lhttp_parser" )
328+ ELSE ()
329+ MESSAGE (STATUS "http-parser version 2 was not found; using bundled 3rd-party sources." )
330+ INCLUDE_DIRECTORIES (deps/http-parser)
331+ FILE (GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
332+ ENDIF ()
333+
335334# Optional external dependency: zlib
336335FIND_PACKAGE (ZLIB)
337336IF (ZLIB_FOUND)
0 commit comments