forked from udacity/CppND-System-Monitor-Project-Updated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
57 lines (48 loc) · 1.62 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
cmake_minimum_required(VERSION 2.6)
project(monitor)
# Set the C++ standard we will use
set(CMAKE_CXX_STANDARD 17)
# Add the path of the cmake files to the CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIRS})
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include_directories(include)
file(GLOB SOURCES "src/*.cpp")
add_executable(monitor ${SOURCES})
set_property(TARGET monitor PROPERTY CXX_STANDARD 17)
target_link_libraries(monitor ${CURSES_LIBRARIES})
# TODO: Run -Werror in CI.
target_compile_options(monitor PRIVATE -Wall -Wextra)
enable_testing()
add_executable(
monitor_test
src/format.cpp
src/linux_parser.cpp
src/linux_system.cpp
src/system_memory.cpp
src/processor.cpp
src/process.cpp
test/format_test.cpp
test/linux_parser_test.cpp
test/linux_system_test.cpp
test/process_test.cpp
test/processor_test.cpp
test/system_memory_test.cpp
)
target_link_libraries(
monitor_test
GTest::gtest_main
)
add_test(monitor_test ${PROJECT_BINARY_DIR})
set_tests_properties(monitor_test PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
include(GoogleTest)
gtest_discover_tests(monitor_test)