-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
103 lines (86 loc) · 2.33 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.1.0...3.5 FATAL_ERROR)
project(csn LANGUAGES C)
option(BUILD_PATCHDD "build patchdd utility" OFF)
option(BUILD_CSN_BENCH "build casync-nano benchmarking utility" OFF)
option(BUILD_CSN "build main casync tool" ON)
option(BUILD_CSN_TOOL "build csn helper tool" OFF)
set(CMAKE_C_VISIBILITY_PRESET hidden)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
add_compile_options(
-Wall
-Wextra
-Wshadow
-Wno-unused-parameter
-Wmissing-noreturn
-Wmissing-prototypes
-Wstrict-prototypes
)
if(CSN_SANITIZE)
add_compile_options(-fsanitize=undefined -fsanitize=address)
link_libraries(-fsanitize=address -fsanitize=undefined)
endif()
if(BUILD_CSN)
include(CTest)
find_package(PkgConfig REQUIRED)
pkg_search_module(ZSTD REQUIRED libzstd)
pkg_search_module(CURL REQUIRED libcurl)
pkg_search_module(CRYPTO REQUIRED libcrypto)
add_executable(csn
log.c
utils.c
chunk.c
chunker.c
caibx.c
sha.c
store.c
store-local.c
store-http.c
index.c
target.c
ui.c
main.c
encrypt.c
)
target_link_libraries(csn ${ZSTD_LIBRARIES} ${CURL_LIBRARIES} ${CRYPTO_LIBRARIES})
target_include_directories(csn PRIVATE ${ZSTD_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${CRYPTO_INCLUDE_DIRS})
install(TARGETS csn RUNTIME DESTINATION bin)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink csn \$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX}/bin/casync)")
if(BUILD_TESTING)
add_subdirectory(test)
endif()
endif()
if(BUILD_PATCHDD)
add_executable(patchdd
log.c
utils.c
ui.c
patchdd.c
)
install(TARGETS patchdd RUNTIME DESTINATION bin)
endif()
if(BUILD_CSN_BENCH)
add_executable(csn-bench
log.c
utils.c
sha.c
chunker.c
test/xorshift32.c
csn-bench.c
)
target_link_libraries(csn-bench ${CRYPTO_LIBRARIES})
target_include_directories(csn-bench PRIVATE ${CRYPTO_INCLUDE_DIRS})
install(TARGETS csn-bench RUNTIME DESTINATION bin)
endif()
if(BUILD_CSN_TOOL)
add_executable(csn-tool
log.c
utils.c
csn-tool.c
encrypt.c
)
target_link_libraries(csn-tool ${CRYPTO_LIBRARIES})
target_include_directories(csn-tool PRIVATE ${CRYPTO_INCLUDE_DIRS})
install(TARGETS csn-tool RUNTIME DESTINATION bin)
endif()