-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
116 lines (87 loc) · 4.39 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
107
108
109
110
111
112
113
114
115
116
cmake_minimum_required(VERSION 3.12..3.15)
project (msync VERSION 0.9.9.8
DESCRIPTION "Store and forward messages with a Mastodon API-compatible server."
HOMEPAGE_URL "https://github.com/Kansattica/msync"
LANGUAGES CXX C)
set (CPACK_PACKAGE_CONTACT "[email protected]")
option(MSYNC_BUILD_TESTS "Download catch2 and build tests with it." ON)
option(MSYNC_FILE_LOG "Log debug messages to msync.log" ON)
option(MSYNC_USER_CONFIG "Store configuration in the OS user configuration folder. Otherwise, store configuration in msync_accounts in the executable's directory." OFF)
set(MSYNC_NLOHMANN_JSON_DIR "" CACHE PATH "Path to a directory to search for Nlohmann JSON. If empty, CMake will download it.")
set(MSYNC_CLIPP_DIR "" CACHE PATH "Path to a directory to search for clipp. If empty, CMake will download it.")
set(MSYNC_WHEREAMI_DIR "" CACHE PATH "Path to a directory to search for whereami. If empty, CMake will download it.")
set(MSYNC_CPR_DIR "" CACHE PATH "Path to a directory to search for cpr. If empty, CMake will download it.")
set(MSYNC_CATCH2_DIR "" CACHE PATH "Path to a directory to search for catch2. If empty, CMake will download it.")
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) #enable interprocedural optimization for all projects
include(cmake/linktimeoptimization.cmake)
include(cmake/packages.cmake)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
include(cmake/compilerflags.cmake)
add_library(queue STATIC "")
add_library(sync STATIC "")
add_library(options STATIC "")
add_library(util STATIC "")
add_library(optionparsing STATIC "")
add_library(printlog STATIC "")
add_library(postfile STATIC "")
add_library(postlist STATIC "")
add_library(net STATIC "")
add_library(accountdirectory STATIC "")
add_library(fixlocale STATIC "")
add_library(netinterface INTERFACE)
add_library(filebacked INTERFACE)
add_library(entities INTERFACE)
add_library(constants INTERFACE)
add_library(exception INTERFACE)
add_executable(msync "")
# see https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/
include(cmake/compatibility.cmake)
# For the files that get "configured" (transformed by cmake with configure-time variables), add this warning at the top so I don't edit the wrong file.
set(INFILEWARNING "* Whoa there, buckaroo!\n* Changes to this file will be lost next time CMake runs!\n* You want to change the file with the name ending with .in.")
add_subdirectory(lib/queue)
add_subdirectory(lib/sync)
add_subdirectory(lib/filesystem)
add_subdirectory(lib/options)
add_subdirectory(lib/constants)
add_subdirectory(lib/net)
add_subdirectory(lib/accountdirectory)
add_subdirectory(lib/fixlocale)
add_subdirectory(lib/postfile)
add_subdirectory(lib/postlist)
add_subdirectory(lib/exception)
add_subdirectory(lib/printlog)
add_subdirectory(lib/util)
add_subdirectory(console/optionparsing)
add_subdirectory(console)
target_include_directories(netinterface INTERFACE lib/netinterface)
target_link_libraries(netinterface INTERFACE filesystem)
target_link_libraries(net PRIVATE ${CPR_LIBRARIES} netinterface filesystem)
target_include_directories(filebacked INTERFACE lib/filebacked)
target_link_libraries(filebacked INTERFACE filesystem)
target_include_directories(entities INTERFACE lib/entities)
target_link_libraries(sync PRIVATE entities printlog queue util netinterface postfile postlist constants filesystem options nlohmannjson)
target_link_libraries(accountdirectory PRIVATE whereami filesystem constants)
target_link_libraries(options PRIVATE printlog exception filebacked constants accountdirectory)
target_link_libraries(options PUBLIC filesystem)
target_link_libraries(postfile PRIVATE filebacked printlog util)
target_link_libraries(postlist PRIVATE filesystem entities)
target_link_libraries(printlog PRIVATE constants)
target_link_libraries(queue PRIVATE constants printlog filebacked exception postfile util)
target_link_libraries(optionparsing PRIVATE clipp::clipp printlog options queue postfile)
target_link_libraries(msync PRIVATE options optionparsing printlog ${CPR_LIBRARIES} util nlohmannjson exception postfile queue sync net netinterface accountdirectory
fixlocale)
if (MSYNC_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
install(TARGETS msync
RUNTIME DESTINATION bin
)
if (UNIX)
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libgcc1, libcurl4")
set(CPACK_GENERATOR "DEB")
endif()
include(CPack)