-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (52 loc) · 1.25 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
cmake_minimum_required(VERSION 3.10)
project(procwatch)
include(FetchContent)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_UNIT_TESTS "Build unit tests" ON)
if (BUILD_UNIT_TESTS)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
FetchContent_MakeAvailable(googletest)
endif()
add_subdirectory(docs)
set(srcs
socket/Socket.h
socket/UnixSocket.h
socket/UnixSocket.cpp
socket/NetlinkSocket.h
socket/NetlinkSocket.cpp
)
add_library(pw_socket ${srcs})
target_include_directories(pw_socket PUBLIC ${CMAKE_CURRENT_LIST_DIR})
set(srcs
procwatch.cpp
)
add_executable(procwatch ${srcs})
target_link_libraries(procwatch PRIVATE pw_socket)
set(srcs
procwatchd.cpp
ProcWatchSvr.h
ProcWatchSvr.cpp
)
add_executable(process_watcher ${srcs})
target_link_libraries(process_watcher PRIVATE pw_socket pthread)
if (BUILD_UNIT_TESTS)
set(srcs
test/unit_tests.cpp
)
add_executable(unit_tests ${srcs})
target_compile_definitions(unit_tests PUBLIC
UNIT_TESTING=1
)
target_include_directories(unit_tests PRIVATE
${gtest_SOURCE_DIR}/include
${gmock_SOURCE_DIR}/include
)
target_link_libraries(unit_tests
gtest
gmock
)
endif()