From e3d51fe5462c4e9ff51dd7dd1982b56f79614d1e Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 12 Jun 2024 16:50:54 +0200 Subject: [PATCH] add project version --- src/CMakeLists.txt | 4 ++++ src/config.h.in | 1 + src/main.c | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 src/config.h.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b9335d..4dcbde7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1) PROJECT(feierabend VERSION 0.0.1) +CONFIGURE_FILE(config.h.in config.h) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + ADD_EXECUTABLE(${PROJECT_NAME} main.c time_format.c diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..4f67b14 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1 @@ +#define PROJECT_VERSION "@PROJECT_VERSION@" \ No newline at end of file diff --git a/src/main.c b/src/main.c index ec55cdd..fe368bc 100644 --- a/src/main.c +++ b/src/main.c @@ -4,6 +4,7 @@ #include "time_format.h" #include "worktime.h" #include "break.h" +#include "config.h" #define ONE_HOUR 3600 @@ -23,6 +24,8 @@ int main(int argc, char* argv[]) char weekday[11]; char timestr[7]; + printf("Version: %s\n\n", PROJECT_VERSION); + time(&begin); localtime_r(&begin, &begin_tm); begin_tm.tm_hour = atoi(argv[1]); -- 2.39.5