-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
79 lines (63 loc) · 2.05 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 2.8)
# For build with ASAN:
# -DCMAKE_C_FLAGS='-O0 -g -fsanitize=address'
#
# For link lexbor library from not system path:
# -DCMAKE_C_FLAGS="-I/path/to/include/lexbor"
# -DCMAKE_EXE_LINKER_FLAGS="-L/path/to/lexbor/lib"
#
set(PROJECT_NAME "warc_parser")
project(${PROJECT_NAME})
message(STATUS "Project name: ${PROJECT_NAME}")
IF(APPLE)
set(CMAKE_MACOSX_RPATH ON)
ENDIF(APPLE)
################
## Version and path
#########################
set(WARC_PARSER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source" CACHE STRING "")
################
## Search and Includes
#########################
include_directories("${WARC_PARSER_SOURCE_DIR}")
################
## C_FLAGS
#########################
message(STATUS "CFLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CXXFLAGS: ${CMAKE_CXX_FLAGS}")
################
## Features
#########################
include("feature.cmake")
################
## Check libraries
#########################
FEATURE_CHECK_LIB_EXIST(WARC_LIB_EXIST "z")
IF(NOT WARC_LIB_EXIST)
message(ERROR "Required library not found: libz (zlib)")
ENDIF()
FEATURE_CHECK_HEADERS_EXIST(WARC_INC_EXIST "zlib" "zlib.h")
IF(NOT WARC_INC_EXIST)
message(FATAL_ERROR "Required headers not found: zlib.h")
ENDIF()
FEATURE_CHECK_LIB_EXIST(WARC_LIB_EXIST "lexbor")
IF(NOT WARC_LIB_EXIST)
message(FATAL_ERROR "Required library not found: liblexbor")
ENDIF()
FEATURE_CHECK_HEADERS_EXIST(WARC_INC_EXIST "lexbor HTML" "lexbor/html/base.h")
IF(NOT WARC_INC_EXIST)
message(FATAL_ERROR "Required headers not found: lexbor/html/*")
ENDIF()
################
## Sources
#########################
file(GLOB_RECURSE WARC_SOURCES "${WARC_PARSER_SOURCE_DIR}/gzip/*.c")
################
## Target
#########################
add_executable("warc_test" ${WARC_SOURCES}
"${WARC_PARSER_SOURCE_DIR}/warc_test.c")
target_link_libraries("warc_test" "lexbor" "z")
add_executable("warc_entry_by_index" ${WARC_SOURCES}
"${WARC_PARSER_SOURCE_DIR}/warc_entry_by_index.c")
target_link_libraries("warc_entry_by_index" "lexbor" "z")