forked from c9s/r3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
62 lines (47 loc) · 2.19 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
# cmake file examples
# https://code.google.com/p/opencv-feature-tracker/source/browse/CMakeLists.txt?r=f804b03e704147e65183c19a50f57abedb22f45c
# TODO:
# cmake clean... orz
# http://stackoverflow.com/questions/9680420/looking-for-a-cmake-clean-command-to-clear-up-cmake-output
# load required modules
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckTypeSize)
cmake_minimum_required(VERSION 3.0)
project(r3 VERSION 2.0.0)
SET(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
${CMAKE_MODULE_PATH}
)
# check for availability of certain headers
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE(jemalloc/jemalloc.h HAVE_JEMALLOC_JEMALLOC_H)
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
# check availability of certain system functions
CHECK_SYMBOL_EXISTS("gettimeofday" "sys/time.h" HAVE_GETTIMEOFDAY)
CHECK_SYMBOL_EXISTS("memset" "string.h" HAVE_MEMSET)
CHECK_SYMBOL_EXISTS("strchr" "string.h" HAVE_STRCHR)
CHECK_SYMBOL_EXISTS("strdup" "string.h" HAVE_STRDUP)
CHECK_SYMBOL_EXISTS("strndup" "string.h" HAVE_STRNDUP)
CHECK_SYMBOL_EXISTS("strnstr" "string.h" HAVE_STRNSTR)
CHECK_SYMBOL_EXISTS("strstr" "string.h" HAVE_STRSTR)
# check availability of certain types
CHECK_TYPE_SIZE(_Bool _BOOL)
# generate the configuration file
configure_file("${PROJECT_SOURCE_DIR}/config.h.cmake" "${PROJECT_BINARY_DIR}/config.h")
include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_BINARY_DIR})
find_package(PCRE REQUIRED)
set(LIBS ${PCRE_LIBRARIES} r3 lib3rdparty)
enable_testing()
add_subdirectory(3rdparty)
add_subdirectory(src)
add_subdirectory(tests)
# add_test(test_tree ${CMAKE_CURRENT_BINARY_DIR}/check_tree)