From 1923a7a8e488900fee91d5e60e1241255b417aea Mon Sep 17 00:00:00 2001 From: evanlin96069 <72735402+evanlin96069@users.noreply.github.com> Date: Fri, 3 May 2024 21:16:54 -0400 Subject: [PATCH] Set version using CMake --- CMakeLists.txt | 7 +++++-- README.md | 2 +- src/output.c | 1 - src/version.h | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 src/version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f908001..2b67c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22.0) -project(nino VERSION 0.0.1 LANGUAGES C) +project(nino VERSION 0.0.6 LANGUAGES C) include(GNUInstallDirs) @@ -64,7 +64,6 @@ set (CORE_SOURCES src/unicode.h src/utils.c src/utils.h - src/version.h ) if (WIN32) @@ -81,6 +80,10 @@ endif() add_executable(${PROJECT_NAME} ${CORE_SOURCES} ${BUNDLED_FILE}) +target_compile_definitions(${PROJECT_NAME} PRIVATE + EDITOR_VERSION="${CMAKE_PROJECT_VERSION}" +) + if (MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W4 /wd4244 /wd4267 /wd4996) else() diff --git a/README.md b/README.md index a5802ea..30758c1 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This project uses CMake for building. Follow these steps to build the project: ### Prerequisites -- CMake (minimum required version, e.g., 3.15) +- CMake (minimum required version, e.g., 3.22.0) - A suitable C compiler (GCC, Clang, MSVC, etc.) ### Cloning the Repository diff --git a/src/output.c b/src/output.c index 494c76c..b545e6e 100644 --- a/src/output.c +++ b/src/output.c @@ -14,7 +14,6 @@ #include "prompt.h" #include "select.h" #include "unicode.h" -#include "version.h" static void editorDrawTopStatusBar(abuf* ab) { const char* right_buf = " nino v" EDITOR_VERSION " "; diff --git a/src/version.h b/src/version.h deleted file mode 100644 index 091e3ab..0000000 --- a/src/version.h +++ /dev/null @@ -1 +0,0 @@ -#define EDITOR_VERSION "0.0.5"