From 969496f15e1e0359e26c2c6e995ad4ef82720f86 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 16 Oct 2020 17:15:49 +0200 Subject: [BUILD] rewrite CMake build system to track changes of source files This change restructures the source code directories, separates shared form non-shared application code and adds CMake dependencies. These dependencies allow the tracking of changes and trigger a rebuild of those build targets where changed files are involved. WARNING: Note that the support of the DNBD3_SERVER_AFL build option is not supported yet. Thus, the option should be never turned on. --- src/client/CMakeLists.txt | 14 ++++++++++++++ src/client/client.c | 10 +++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/client/CMakeLists.txt (limited to 'src/client') diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt new file mode 100644 index 0000000..a7c1eb4 --- /dev/null +++ b/src/client/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) + +# set the project name +project(dnbd3-client) + +# suppress -Wmultichar warnings +add_compile_options(-Wno-multichar) + +# add compile option to enable enhanced BSD netdb features +add_compile_options(-D_GNU_SOURCE) + +add_executable(dnbd3-client ${CMAKE_CURRENT_SOURCE_DIR}/client.c) +target_link_libraries(dnbd3-client dnbd3-version dnbd3-shared) +install(TARGETS dnbd3-client RUNTIME DESTINATION bin) diff --git a/src/client/client.c b/src/client/client.c index 37f0558..33737fa 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -18,9 +18,9 @@ * */ -#include "../clientconfig.h" -#include "../types.h" -#include "../version.h" +#include +#include +#include #include #include @@ -643,7 +643,7 @@ static int dnbd3_daemon_send(int argc, char **argv) static void dnbd3_print_help(char *argv_0) { - printf( "Version: %s\n\n", VERSION_STRING ); + printf( "Version: %s\n", DNBD3_VERSION ); printf( "\nUsage: %s\n" "\t-h -i [-r ] -d [-a ] || -c -d \n\n", argv_0 ); printf( "Start the DNBD3 client.\n" ); @@ -665,6 +665,6 @@ static void dnbd3_print_help(char *argv_0) void dnbd3_print_version() { - printf( "Version: %s\n", VERSION_STRING ); + printf( "dnbd3-client version: %s\n", DNBD3_VERSION ); exit( EXIT_SUCCESS ); } -- cgit v1.2.3-55-g7522