This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
175 lines (144 loc) · 3.39 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
cmake_minimum_required(VERSION 2.6)
project(capture-thread)
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/common)
set(CMAKE_CXX_FLAGS "-Wall -pedantic -std=c++11 -O2 -g -pthread")
IF(NOT USE_PREFIX)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}")
ENDIF()
SET(INSTALL_INCLUDEDIR "include")
SET(INSTALL_LIBDIR "lib")
SET(INSTALL_PATH "${CMAKE_INSTALL_PREFIX}")
SET(INCLUDE_PATH "${INSTALL_PATH}/${INSTALL_INCLUDEDIR}")
SET(LIBRARY_PATH "${INSTALL_PATH}/${INSTALL_LIBDIR}")
INCLUDE(FindThreads)
FIND_LIBRARY(PTHREAD_LIBRARY
NAMES pthread
QUIET
ONLY_CMAKE_FIND_ROOT_PATH)
IF(NOT PTHREAD_LIBRARY)
SET(PTHREAD_LIBRARY "")
ENDIF()
add_library(capture-thread STATIC
src/thread-crosser.cc)
add_executable(async
example/async.cc)
target_link_libraries(async
capture-thread
${PTHREAD_LIBRARY})
add_executable(connection
example/connection.cc)
target_link_libraries(connection
capture-thread)
add_executable(function
example/function.cc)
target_link_libraries(function
capture-thread)
add_executable(inherit
example/inherit.cc)
target_link_libraries(inherit
capture-thread)
add_executable(limit
example/limit.cc)
target_link_libraries(
limit
capture-thread)
add_executable(manual
example/manual.cc)
target_link_libraries(manual
capture-thread
${PTHREAD_LIBRARY})
add_executable(mock
example/mock.cc)
target_link_libraries(mock
capture-thread)
add_executable(multi
example/multi.cc)
target_link_libraries(multi
capture-thread
${PTHREAD_LIBRARY})
add_executable(paths
example/paths.cc)
target_link_libraries(
paths
capture-thread)
add_executable(simple
example/simple.cc)
target_link_libraries(
simple
capture-thread)
add_executable(speed
example/speed.cc)
target_link_libraries(
speed
capture-thread)
add_executable(threaded
example/threaded.cc)
target_link_libraries(
threaded
capture-thread
${PTHREAD_LIBRARY})
add_executable(throttle
example/throttle.cc)
target_link_libraries(
throttle
capture-thread
${PTHREAD_LIBRARY})
add_executable(trace
example/trace.cc)
target_link_libraries(
trace
capture-thread
${PTHREAD_LIBRARY})
add_executable(demo-main
demo/main.cc
demo/logging.cc
demo/tracing.cc
common/callback-queue.cc)
target_link_libraries(demo-main
capture-thread
${PTHREAD_LIBRARY})
add_executable(readme-test
test/readme-test.cc)
target_link_libraries(readme-test
capture-thread
${PTHREAD_LIBRARY})
INSTALL(TARGETS
capture-thread
DESTINATION ${INSTALL_LIBDIR})
INSTALL(FILES
include/thread-capture.h
include/thread-crosser.h
DESTINATION ${INSTALL_INCLUDEDIR})
find_package(GTest)
if(GTEST_LIBRARIES)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(thread-capture-test
test/thread-capture-test.cc
common/log-text.cc
common/log-values.cc
common/callback-queue.cc)
target_link_libraries(thread-capture-test
gtest gmock gtest_main
capture-thread
${PTHREAD_LIBRARY})
add_executable(thread-crosser-test
test/thread-crosser-test.cc
common/log-text.cc
common/log-values.cc
common/callback-queue.cc)
target_link_libraries(thread-crosser-test
gtest gmock gtest_main
capture-thread
${PTHREAD_LIBRARY})
add_executable(demo-test
demo/test.cc
demo/logging.cc
demo/tracing.cc
common/callback-queue.cc)
target_link_libraries(demo-test
gtest gmock gtest_main
capture-thread
${PTHREAD_LIBRARY})
endif()