-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
76 lines (54 loc) · 2.26 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
# (C) 2021 by [email protected]
# released under Apache license v2.0
cmake_minimum_required(VERSION 3.9.4)
project(lock_tracer VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_STANDARD 99)
add_definitions("-D_FILE_OFFSET_BITS=64")
set(CMAKE_BUILD_TYPE Debug)
add_compile_options(-Wall -pedantic)
add_library(lock_tracer SHARED
lock_tracer.cpp
)
add_executable(test
test.c
)
add_executable(analyzer
analyzer.cpp
)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
target_link_libraries(lock_tracer Threads::Threads)
target_link_libraries(test Threads::Threads)
include(FindPkgConfig)
pkg_check_modules(JANSSON REQUIRED jansson)
target_link_libraries(lock_tracer ${JANSSON_LIBRARIES})
target_include_directories(lock_tracer PUBLIC ${JANSSON_INCLUDE_DIRS})
target_compile_options(lock_tracer PUBLIC ${JANSSON_CFLAGS_OTHER})
pkg_check_modules(LIBUNWIND REQUIRED libunwind)
target_link_libraries(lock_tracer ${LIBUNWIND_LIBRARIES})
target_include_directories(lock_tracer PUBLIC ${LIBUNWIND_INCLUDE_DIRS})
target_compile_options(lock_tracer PUBLIC ${LIBUNWIND_CFLAGS_OTHER})
target_link_libraries(analyzer ${JANSSON_LIBRARIES})
target_include_directories(analyzer PUBLIC ${JANSSON_INCLUDE_DIRS})
target_compile_options(analyzer PUBLIC ${JANSSON_CFLAGS_OTHER})
pkg_check_modules(GVC libgvc)
target_link_libraries(analyzer ${GVC_LIBRARIES})
target_include_directories(analyzer PUBLIC ${GVC_INCLUDE_DIRS})
target_compile_options(analyzer PUBLIC ${GVC_CFLAGS_OTHER})
target_link_libraries(lock_tracer -ldl)
target_link_libraries(lock_tracer -rdynamic)
target_link_libraries(test -rdynamic)
target_compile_options(lock_tracer PRIVATE "-Wall")
target_compile_options(lock_tracer PRIVATE "-pedantic")
target_compile_options(test PRIVATE "-Wall")
target_compile_options(analyzer PRIVATE "-Wall")
target_compile_options(analyzer PRIVATE "-pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -ggdb3")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -ggdb3")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb3")
configure_file(config.h.in config.h)
target_include_directories(analyzer PUBLIC "${PROJECT_BINARY_DIR}")
target_include_directories(lock_tracer PUBLIC "${PROJECT_BINARY_DIR}")