-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (54 loc) · 1.75 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
cmake_minimum_required(VERSION 3.14)
project(FilesSync LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# add_subdirectory(thirdparty)
# add_subdirectory(src)
# add_subdirectory(ut)
# include_directories(${PROJECT_SOURCE_DIR}/src)
# include_directories(${PROJECT_SOURCE_DIR}/ut)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_Declare(
googlemock
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(googletest)
FetchContent_MakeAvailable(json)
set(SRC_LIST
src/Machine.cpp
src/Synchronizer.cpp
src/MachinesSync.cpp
src/FileInfo.cpp
src/Time.cpp
src/Menu.cpp
src/ExitApp.cpp
src/SettingApp.cpp
src/Stats.cpp
)
set(TEST_LIST
${SRC_LIST}
ut/FileInfoTests.cpp
ut/MachinesSyncTests.cpp
ut/MachineTests.cpp
ut/SynchronizerTests.cpp
ut/TimeTests.cpp
ut/StatsTests.cpp
)
add_executable(${PROJECT_NAME} ${SRC_LIST} main.cpp )
target_link_libraries(FilesSync PRIVATE nlohmann_json::nlohmann_json)
# target_compile_options(${PROJECT_NAME} PUBLIC -Wall -Werror -Wpedantic -Wextra -O3)
add_executable(${PROJECT_NAME}-debug ${SRC_LIST} main.cpp)
target_link_libraries(FilesSync-debug PRIVATE nlohmann_json::nlohmann_json)
target_compile_options(${PROJECT_NAME}-debug PUBLIC -O0 -g )
# Now simply link against gtest or gtest_main as needed. Eg
add_executable(${PROJECT_NAME}-gt ${TEST_LIST})
target_link_libraries(${PROJECT_NAME}-gt gtest_main gmock_main nlohmann_json::nlohmann_json)
enable_testing()
add_test(NAME ${PROJECT_NAME}-test COMMAND ${PROJECT_NAME}-gt)