-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
92 lines (73 loc) · 1.99 KB
/
CMakeLists.txt
File metadata and controls
92 lines (73 loc) · 1.99 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.2)
if(NOT DEFINED ENV{TRAVIS_BUILD_NUMBER})
set(ENV{TRAVIS_BUILD_NUMBER} 42)
endif()
project(hw07_bayan VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER})
# Build googletest
exec_program(git ARGS submodule update --init --recursive)
get_filename_component(GTEST_SOURCE ../googletest ABSOLUTE)
add_subdirectory(
"${GTEST_SOURCE}"
"googletest"
)
# Boost
find_package(Boost COMPONENTS system filesystem program_options REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(
bayan main.cpp
files.h files.cpp
hash.h hash.cpp
store.h
)
add_executable(
test_bayan
tests/test_files.cpp
tests/test_hash.cpp
tests/test_store.cpp
files.h files.cpp
hash.h hash.cpp
store.h
)
set_target_properties(bayan test_bayan PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
target_include_directories(test_bayan PRIVATE .)
target_link_libraries(test_bayan PRIVATE
gtest gtest_main
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
)
target_link_libraries(bayan PRIVATE
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
if (MSVC)
target_compile_options(
bayan PRIVATE
/W4
)
target_compile_options(
test_bayan PRIVATE
/W4
)
else ()
target_compile_options(
bayan PRIVATE
-Wall -Wextra -pedantic -Werror
)
target_compile_options(
test_bayan PRIVATE
-Wall -Wextra -pedantic -Werror
)
endif()
install(TARGETS bayan RUNTIME DESTINATION bin)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT j@vladnf.ru)
include(CPack)
enable_testing()
add_test(test_bayan test_bayan)