Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
7a6e0281
Commit
7a6e0281
authored
May 02, 2013
by
Veeti Paananen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build with the system's http-parser installation if available
parent
b2984e8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
3 deletions
+51
-3
CMakeLists.txt
+12
-3
cmake/Modules/FindHTTP_Parser.cmake
+39
-0
No files found.
CMakeLists.txt
View file @
7a6e0281
...
...
@@ -14,7 +14,8 @@
PROJECT
(
libgit2 C
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.6
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
# Add find modules to the path
SET
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
# Build options
#
...
...
@@ -100,8 +101,16 @@ ELSE ()
IF
(
NOT AMIGA
)
FIND_PACKAGE
(
OpenSSL
)
ENDIF
()
FILE
(
GLOB SRC_HTTP deps/http-parser/*.c
)
INCLUDE_DIRECTORIES
(
deps/http-parser
)
FIND_PACKAGE
(
HTTP_Parser QUIET
)
IF
(
HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2
)
INCLUDE_DIRECTORIES
(
${
HTTP_PARSER_INCLUDE_DIRS
}
)
LINK_LIBRARIES
(
${
HTTP_PARSER_LIBRARIES
}
)
ELSE
()
MESSAGE
(
"http-parser was not found or is too old; using bundled 3rd-party sources."
)
INCLUDE_DIRECTORIES
(
deps/http-parser
)
FILE
(
GLOB SRC_HTTP deps/http-parser/*.c
)
ENDIF
()
ENDIF
()
# Specify sha1 implementation
...
...
cmake/Modules/FindHTTP_Parser.cmake
0 → 100644
View file @
7a6e0281
# - Try to find http-parser
#
# Defines the following variables:
#
# HTTP_PARSER_FOUND - system has http-parser
# HTTP_PARSER_INCLUDE_DIR - the http-parser include directory
# HTTP_PARSER_LIBRARIES - Link these to use http-parser
# HTTP_PARSER_VERSION_MAJOR - major version
# HTTP_PARSER_VERSION_MINOR - minor version
# HTTP_PARSER_VERSION_STRING - the version of http-parser found
# Find the header and library
FIND_PATH
(
HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h
)
FIND_LIBRARY
(
HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser
)
# Found the header, read version
if
(
HTTP_PARSER_INCLUDE_DIR AND EXISTS
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
)
FILE
(
READ
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
HTTP_PARSER_H
)
IF
(
HTTP_PARSER_H
)
STRING
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MAJOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MAJOR
"
${
HTTP_PARSER_H
}
"
)
STRING
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MINOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MINOR
"
${
HTTP_PARSER_H
}
"
)
SET
(
HTTP_PARSER_VERSION_STRING
"
${
HTTP_PARSER_VERSION_MAJOR
}
.
${
HTTP_PARSER_VERSION_MINOR
}
"
)
ENDIF
()
UNSET
(
HTTP_PARSER_H
)
ENDIF
()
# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
# to TRUE if all listed variables are TRUE
INCLUDE
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
# Hide advanced variables
MARK_AS_ADVANCED
(
HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
# Set standard variables
IF
(
HTTP_PARSER_FOUND
)
SET
(
HTTP_PARSER_LIBRARIES
${
HTTP_PARSER_LIBRARY
}
)
set
(
HTTP_PARSER_INCLUDE_DIRS
${
HTTP_PARSER_INCLUDE_DIR
}
)
ENDIF
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment