]> gitweb.hhaalo.de Git - discspan.git/commitdiff
add: get version from libspandisc
authorBastian Dehn <hhaalo@arcor.de>
Fri, 27 Aug 2021 07:20:47 +0000 (09:20 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 27 Aug 2021 07:20:47 +0000 (09:20 +0200)
libs/spandisc/CMakeLists.txt
libs/spandisc/include/config.h.in [new file with mode: 0644]
libs/spandisc/include/logic.h
libs/spandisc/src/logic.c
src/discspan.c

index a697c830f6d95fc4fdc5566fdd3b1042d7fbe8c0..c9aad11423bda6c52235e2e338b262e172955c78 100644 (file)
@@ -12,6 +12,9 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
 
 option(BUILD_SHARED_LIBS "build shared libs" ON)
 
+configure_file(include/config.h.in include/config.h)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
+
 file(GLOB SOURCES src/*.c)
 file(GLOB PUBLIC_HEADER include/*.h)
 include_directories(include)
diff --git a/libs/spandisc/include/config.h.in b/libs/spandisc/include/config.h.in
new file mode 100644 (file)
index 0000000..33ec557
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef SPANDISC_CONFIG_IN_H
+#define SPANDISC_CONFIG_IN_H
+
+#define VERSION "@PROJECT_VERSION@"
+
+#endif
index 6e5ae953ec39624f7dca9ec24901ce57d7553f04..40b70f621e352b8e68e1060c36a842e452057c83 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LOGIC_H
 #define _LOGIC_H
 
+const char *get_version();
+
 /**
  * Event pointer to method execute by the writing file.
  * This Method is called by span
index df3eb286a640b28a96529b335dcfebe35320f46b..98ca8b5eb960b0249f5044eeff245f2077ef5dda 100644 (file)
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
 #include "spandisc.h"
 #include "logic.h"
 #include "splitter.h"
@@ -9,6 +10,11 @@
 
 status_print_t status_print = NULL;
 
+const char * get_version()
+{
+       return VERSION;
+}
+
 void on_status_print(const char *output, medium_t disc)
 {
        if (status_print != NULL)
index 4bf7511d163974b03bcc6d476f6f7de920ac699f..0b4dd27c537e07d7182120ac3eaa42d1fde2a001 100644 (file)
@@ -16,6 +16,7 @@ typedef struct {
 void show_version()
 {
        printf("discspan %s\n", VERSION);
+       printf("libspandisc %s\n", get_version());
 }
 
 param_t read_argument(int argc, char *argv[])