summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-12-28 00:04:20 +0300
committerOxore <oxore@protonmail.com>2023-12-28 00:04:20 +0300
commit18893127524d87e47a948b9a92d8d8b2ab869852 (patch)
tree1491660a439221174a776b9c7f38f05234590cdb /CMakeLists.txt
parent4faf778b6ec4b9d8ab0c19e22d27c76f4c67ab28 (diff)
WIP
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 31 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b0a77a..40a1814 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,15 +33,40 @@ set(compile_flags
-Wcast-align
-Wshadow
)
+set(compile_definitions
+ $<$<CONFIG:Debug>:_FORTIFY_SOURCE=2>
+ LOG_ERROR=1
+ LOG_WARNING=1
+ LOG_INFO=1
+ $<$<CONFIG:Debug>:LOG_DEBUG=1>
+ $<$<CONFIG:Debug>:LOG_TRACE=0>
+ $<$<NOT:$<CONFIG:Debug>>:LOG_DEBUG=0>
+ $<$<NOT:$<CONFIG:Debug>>:LOG_TRACE=0>
+ )
+
+add_library(timespec OBJECT lib/timespec/timespec.c lib/timespec/timespec.h)
+target_compile_options(timespec PRIVATE ${compile_flags})
+target_compile_definitions(timespec PRIVATE ${compile_definitions})
+target_link_options(timespec PRIVATE $<$<CONFIG:Debug>:${common_debug_flags}>)
+
+add_library(common OBJECT
+ proto.c
+ proto.h
+ proto_io.c
+ proto_io.h
+ )
+target_compile_options(common PRIVATE ${compile_flags})
+target_compile_definitions(common PRIVATE ${compile_definitions})
+target_link_options(common PRIVATE $<$<CONFIG:Debug>:${common_debug_flags}>)
-add_executable(server server.c)
+add_executable(server server.c $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:timespec>)
target_compile_options(server PRIVATE ${compile_flags})
-target_compile_definitions(server PRIVATE $<$<CONFIG:Debug>:_FORTIFY_SOURCE=2>)
+target_compile_definitions(server PRIVATE ${compile_definitions})
target_link_options(server PRIVATE $<$<CONFIG:Debug>:${common_debug_flags}>)
-target_include_directories(server PRIVATE .)
+target_include_directories(server PRIVATE . lib)
-add_executable(client client.c)
+add_executable(client client.c $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:timespec>)
target_compile_options(client PRIVATE ${compile_flags})
-target_compile_definitions(client PRIVATE $<$<CONFIG:Debug>:_FORTIFY_SOURCE=2>)
+target_compile_definitions(client PRIVATE ${compile_definitions})
target_link_options(client PRIVATE $<$<CONFIG:Debug>:${common_debug_flags}>)
-target_include_directories(client PRIVATE .)
+target_include_directories(client PRIVATE . lib)