-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
106 lines (90 loc) · 2.58 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
104
105
106
cmake_minimum_required (VERSION 3.9.6)
project(zipsync CXX C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(ZIPSYNC_OPTION_BUILD_TESTS "build executable with unit tests" ON)
option(ZIPSYNC_OPTION_BUILD_TOOL "build command-line zipsync tool" ON)
option(ZIPSYNC_OPTION_THIRDPARTY_MODULE_MODE "link third-party libs using module mode of find_package" OFF)
set(lib_sources
minizip_extra.c
minizip_extra.h
minizip_private.h
StdString.cpp
StdString.h
Logging.h
Logging.cpp
Ini.h
Ini.cpp
Hash.h
Hash.cpp
Path.h
Path.cpp
Utils.h
Utils.cpp
ZipUtils.h
ZipUtils.cpp
ChecksummedZip.h
ChecksummedZip.cpp
Manifest.h
Manifest.cpp
LocalCache.h
LocalCache.cpp
ZipSync.h
ZipSync.cpp
Downloader.h
Downloader.cpp
ZipSync.natvis
)
set(tests_sources
StdFilesystem.cpp
StdFilesystem.h
TestCreator.cpp
TestCreator.h
Fuzzer.cpp
Fuzzer.h
TestsMain.cpp
HttpServer.cpp
HttpServer.h
)
set(extralib_sources
StdFilesystem.cpp
StdFilesystem.h
Wildcards.cpp
Wildcards.h
CommandLine.cpp
CommandLine.h
)
set(zipsynccmd_sources
CommandLineMain.cpp
)
if(MSVC)
add_compile_options("/W2")
add_compile_options("$<$<CONFIG:RelWithDebInfo>:/Ob2>")
endif()
find_package(zlib REQUIRED)
find_package(minizip REQUIRED)
find_package(CURL REQUIRED)
find_package(blake2 REQUIRED)
add_library(libzipsync STATIC ${lib_sources})
if(ZIPSYNC_OPTION_THIRDPARTY_MODULE_MODE)
target_include_directories(libzipsync PUBLIC ${minizip_INCLUDE_DIRS} ${zlib_INCLUDE_DIRS} ${BLAKE2_INCLUDE_DIRS} PRIVATE ${CURL_INCLUDE_DIRS})
target_link_libraries(libzipsync PRIVATE ${minizip_LIBRARIES} ${zlib_LIBRARIES} ${BLAKE2_LIBRARIES} ${CURL_LIBRARIES})
else()
target_link_libraries(libzipsync PUBLIC minizip::minizip blake2::blake2 PRIVATE CURL::libcurl)
endif()
add_library(libzipsyncextra STATIC ${extralib_sources})
target_link_libraries(libzipsyncextra PUBLIC libzipsync)
if(NOT MSVC)
target_link_libraries(libzipsyncextra PUBLIC stdc++fs)
endif()
if(ZIPSYNC_OPTION_BUILD_TESTS)
find_package(doctest REQUIRED CONFIG)
find_package(libmicrohttpd REQUIRED CONFIG)
add_executable(tests ${tests_sources})
target_link_libraries(tests libzipsync libzipsyncextra doctest::doctest libmicrohttpd::libmicrohttpd CURL::libcurl minizip::minizip blake2::blake2)
endif()
if(ZIPSYNC_OPTION_BUILD_TOOL)
find_package(args REQUIRED CONFIG)
add_executable(zipsync ${zipsynccmd_sources})
target_link_libraries(zipsync libzipsync libzipsyncextra args::args)
endif()