diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 37 |
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) |