-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
83 lines (72 loc) · 2.68 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
80
81
82
83
cmake_minimum_required(VERSION 2.8)
project(upcgen)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
main.cpp
main.h
ahocorasick/actypes.h
ahocorasick/ahocorasick.h
ahocorasick/ahocorasick.c
ahocorasick/mpool.h
ahocorasick/mpool.c
ahocorasick/node.h
ahocorasick/node.c
ahocorasick/replace.h
ahocorasick/replace.c)
set(SOURCE_FILES_UPC
upc_keys_gen.h
upc_keys_gen.cpp
ahocorasick/actypes.h
ahocorasick/ahocorasick.h
ahocorasick/ahocorasick.c
ahocorasick/mpool.h
ahocorasick/mpool.c
ahocorasick/node.h
ahocorasick/node.c
ahocorasick/replace.h
ahocorasick/replace.c)
set(SOURCE_FILES_STATS
main.h
statistics.cpp
ahocorasick/actypes.h
ahocorasick/ahocorasick.h
ahocorasick/ahocorasick.c
ahocorasick/mpool.h
ahocorasick/mpool.c
ahocorasick/node.h
ahocorasick/node.c
ahocorasick/replace.h
ahocorasick/replace.c)
set(SOURCE_FILES_UPC_KEYS
upc_keys.c)
add_executable(upcgen ${SOURCE_FILES})
add_executable(upckeysgen ${SOURCE_FILES_UPC})
add_executable(stats ${SOURCE_FILES_STATS})
add_executable(upckeys ${SOURCE_FILES_UPC_KEYS})
# OpenSSL
find_library(OPENSSL_LIB crypto $ENV{OPENSSL_LIB_PATH})
if(NOT OPENSSL_LIB)
message(FATAL_ERROR "OpenSSL library not found. Rerun cmake with -DCMAKE_PREFIX_PATH=\"<path to lib1>;<path to lib2>\"")
endif()
message("OPENSSL_LIB: ${OPENSSL_LIB}, include dir: ${OPENSSL_INCLUDE_DIR}, version: ${OPENSSL_VERSION}, root: ${OPENSSL_ROOT_DIR}, path: $ENV{OPENSSL_LIB_PATH}")
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${OPENSSL_LIB})
find_path(OPENSSL_INCLUDE_PATH openssl/md5.h $ENV{OPENSSL_LIB_PATH} PATHS /opt/local /usr/local /usr)
if(NOT OPENSSL_INCLUDE_PATH)
message(FATAL_ERROR "OpenSSL library include files not found.")
endif()
message("OPENSSL_INCLUDE_PATH: ${OPENSSL_INCLUDE_PATH}")
include_directories(${INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_PATH})
# SQLite
find_library(SQLITE3_LIB sqlite3 $ENV{SQLITE3_LIB_PATH} PATHS /opt/local /usr/local /usr)
if(NOT SQLITE3_LIB)
message(FATAL_ERROR "SQLite3 library not found. Rerun cmake with -DCMAKE_PREFIX_PATH=\"<path to lib1>;<path to lib2>\"")
endif()
message("SQLITE3_LIB: ${SQLITE3_LIB}")
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${SQLITE3_LIB})
# Linking
target_link_libraries(upcgen ${OPENSSL_LIB} ${SQLITE3_LIB})
target_link_libraries(upckeysgen ${OPENSSL_LIB} ${SQLITE3_LIB})
target_link_libraries(stats ${OPENSSL_LIB} ${SQLITE3_LIB})
target_link_libraries(upckeys ${OPENSSL_LIB} )
# Release mode for fast computation
set(CMAKE_BUILD_TYPE Release)