From 3977d85fee8af324d4958ccae969861c6203893d Mon Sep 17 00:00:00 2001 From: Grayson Riffe Date: Thu, 4 Jun 2026 11:16:13 -0500 Subject: [PATCH] Add version system --- WatchfulEye/CMakeLists.txt | 5 +++++ WatchfulEye/src/main.cpp | 4 +++- WatchfulEye/src/version.h.in | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 WatchfulEye/src/version.h.in diff --git a/WatchfulEye/CMakeLists.txt b/WatchfulEye/CMakeLists.txt index 66d0650..eec64a6 100644 --- a/WatchfulEye/CMakeLists.txt +++ b/WatchfulEye/CMakeLists.txt @@ -8,3 +8,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /entry:mainCRTStartup") if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") set_property(TARGET WatchfulEye PROPERTY WIN32_EXECUTABLE FALSE) endif() + +find_package(Git) +execute_process(COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE APPVERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +configure_file(src/version.h.in version.h) +target_include_directories(WatchfulEye PUBLIC "${PROJECT_BINARY_DIR}/WatchfulEye") diff --git a/WatchfulEye/src/main.cpp b/WatchfulEye/src/main.cpp index e30fdfb..acfcdfd 100644 --- a/WatchfulEye/src/main.cpp +++ b/WatchfulEye/src/main.cpp @@ -1,8 +1,10 @@ // Watchful Eye main file #include +#include "version.h" + int main(int argc, char* argv[]) { - std::cout << "Watchful Eye\n"; + std::cout << "Watchful Eye " APPVERSION "\n"; std::cin.get(); return EXIT_SUCCESS; diff --git a/WatchfulEye/src/version.h.in b/WatchfulEye/src/version.h.in new file mode 100644 index 0000000..8db2e05 --- /dev/null +++ b/WatchfulEye/src/version.h.in @@ -0,0 +1,2 @@ +// Version configured header file +#define APPVERSION "@APPVERSION@"