Direct use the source code of http-parser

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
Jianhui Zhao committed 2017-11-22 14:11:31 +08:00
1 parent 2ad01f73ce
commit 09c950bbac
6 files changed
+2843 -40

No files matched your search

-34
View File
@@ -1,34 +0,0 @@
# - Try to find http-parser
# Once done this will define
# HTTPPARSER_FOUND - System has http-parser
# HTTPPARSER_INCLUDE_DIRS - The http-parser include directories
# HTTPPARSER_LIBRARIES - The libraries needed to use http-parser
find_path(HTTPPARSER_INCLUDE_DIR http_parser.h)
find_library(HTTPPARSER_LIBRARY http_parser PATH_SUFFIXES lib64)
if(HTTPPARSER_INCLUDE_DIR)
file(STRINGS "${HTTPPARSER_INCLUDE_DIR}/http_parser.h"
HTTP_PARSER_VERSION_MAJOR REGEX "^#define[ \t]+HTTP_PARSER_VERSION_MAJOR[ \t]+[0-9]+")
file(STRINGS "${HTTPPARSER_INCLUDE_DIR}/http_parser.h"
HTTP_PARSER_VERSION_MINOR REGEX "^#define[ \t]+HTTP_PARSER_VERSION_MINOR[ \t]+[0-9]+")
string(REGEX REPLACE "[^0-9]+" "" HTTP_PARSER_VERSION_MAJOR "${HTTP_PARSER_VERSION_MAJOR}")
string(REGEX REPLACE "[^0-9]+" "" HTTP_PARSER_VERSION_MINOR "${HTTP_PARSER_VERSION_MINOR}")
set(HTTP_PARSER_VERSION "${HTTP_PARSER_VERSION_MAJOR}.${HTTP_PARSER_VERSION_MINOR}")
unset(HTTP_PARSER_VERSION_MINOR)
unset(HTTP_PARSER_VERSION_MAJOR)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set HTTPPARSER_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(HttpParser REQUIRED_VARS
HTTPPARSER_LIBRARY HTTPPARSER_INCLUDE_DIR
VERSION_VAR HTTP_PARSER_VERSION)
if(HTTPPARSER_FOUND)
set(HTTPPARSER_LIBRARIES ${HTTPPARSER_LIBRARY})
set(HTTPPARSER_INCLUDE_DIRS ${HTTPPARSER_INCLUDE_DIR})
endif()
mark_as_advanced(HTTPPARSER_INCLUDE_DIR HTTPPARSER_LIBRARY)