-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (63 loc) · 1.61 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
cmake_minimum_required(VERSION 3.20)
project(DynamicDNS
VERSION 1.0.0
DESCRIPTION "Dynamic DNS Updater"
LANGUAGES CXX
)
set(CORE_LIB ${PROJECT_NAME}_core_lib)
set(EXECUTABLE ${PROJECT_NAME}_exec)
set(TESTS_EXECUTABLE ${PROJECT_NAME}_tests_exec)
include(FetchContent)
FetchContent_Declare(cpr
GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG dec9422db3af470641f8b0d90e4b451c4daebf64
)
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03
)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG b514bdc898e2951020cbdca1304b75f5950d1f59
)
FetchContent_MakeAvailable(cpr)
FetchContent_MakeAvailable(json)
FetchContent_MakeAvailable(googletest)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Wall -Wextra -Werror)
enable_testing()
add_library(${CORE_LIB})
add_executable(${EXECUTABLE})
target_include_directories(${CORE_LIB}
PUBLIC
${CMAKE_SOURCE_DIR}
)
add_subdirectory(src)
target_link_libraries(${CORE_LIB}
PRIVATE
cpr::cpr
PUBLIC
nlohmann_json::nlohmann_json
)
target_link_libraries(${EXECUTABLE}
PRIVATE
${CORE_LIB}
)
add_executable(${TESTS_EXECUTABLE})
target_include_directories(${TESTS_EXECUTABLE}
PUBLIC
${CMAKE_SOURCE_DIR}
)
add_subdirectory(tests)
target_link_libraries(${TESTS_EXECUTABLE}
PRIVATE
${CORE_LIB}
GTest::gtest
GTest::gtest_main
nlohmann_json::nlohmann_json
)
include(GoogleTest)
gtest_discover_tests(${TESTS_EXECUTABLE})