-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
130 lines (104 loc) · 2.13 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required( VERSION 2.8.12 FATAL_ERROR )
project( hourglass )
set( CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage"
)
set( CMAKE_CXX_FLAGS_DEBUG
"-O0 -g3"
)
set( CMAKE_CXX_FLAGS_RELEASE
"-O3"
)
find_package( Threads REQUIRED )
aux_source_directory( src SRC )
file( GLOB INCLUDE include/*.hpp )
add_library(
hourglass
SHARED
${SRC}
)
target_compile_options(
hourglass
PRIVATE
-pthread
-std=c++11
-Wall
-Wextra
-Wshadow
)
target_include_directories(
hourglass
PUBLIC
include
)
target_link_libraries(
hourglass
pthread
)
set( GOOGLETEST_ROOT
external/googletest/googletest CACHE STRING "Google Test source root"
)
set( GOOGLETEST_SOURCES
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest-all.cc
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest_main.cc
)
foreach( _source ${GOOGLETEST_SOURCES} )
set_source_files_properties( ${_source} PROPERTIES GENERATED 1 )
endforeach()
add_library(
googletest
${GOOGLETEST_SOURCES}
)
target_include_directories(
googletest
PUBLIC
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/include
)
add_executable(
unit_tests
test/main.cpp
test/hourglass_unit.cpp
)
add_dependencies(
unit_tests
googletest
)
target_include_directories(
unit_tests
PUBLIC
../include
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/include
)
target_compile_options(
unit_tests
PRIVATE
-std=c++11
-Wall
-Wextra
-Wshadow
)
target_link_libraries(
unit_tests
googletest
hourglass
pthread
)
include( CTest )
enable_testing()
add_test( unit
${PROJECT_BINARY_DIR}/unit_tests
)
install(
TARGETS
${PROJECT_NAME}
DESTINATION
/usr/local/lib
)
install(
FILES
${INCLUDE}
DESTINATION
/usr/local/include/hourglass/
)