@@ -235,10 +235,21 @@ IF (WIN32 AND EMBED_SSH_PATH)
235235 ADD_DEFINITIONS (-DGIT_SSH)
236236ENDIF ()
237237
238- IF (WIN32 AND WINHTTP)
239- ADD_DEFINITIONS (-DGIT_WINHTTP)
238+
239+ FIND_PACKAGE (HTTP_Parser)
240+ IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
241+ INCLUDE_DIRECTORIES (${HTTP_PARSER_INCLUDE_DIRS} )
242+ LINK_LIBRARIES (${HTTP_PARSER_LIBRARIES} )
243+ LIST (APPEND LIBGIT2_PC_LIBS "-lhttp_parser" )
244+ ELSE ()
245+ MESSAGE (STATUS "http-parser was not found or is too old; using bundled 3rd-party sources." )
240246 INCLUDE_DIRECTORIES (deps/http-parser)
241247 FILE (GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
248+ ENDIF ()
249+
250+
251+ IF (WIN32 AND WINHTTP)
252+ ADD_DEFINITIONS (-DGIT_WINHTTP)
242253
243254 # Since MinGW does not come with headers or an import library for winhttp,
244255 # we have to include a private header and generate our own import library
@@ -291,17 +302,6 @@ ELSE ()
291302 LINK_LIBRARIES (${CURL_LIBRARIES} )
292303 LIST (APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS} )
293304 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 ()
305305ENDIF ()
306306
307307# Specify sha1 implementation
0 commit comments