diff --git a/.gitignore b/.gitignore index 33cb249..de21386 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # -------------------- Output -------------------- out/ +src/YYCC/YYCCVersion.hpp CMakeSettings.json # -------------------- VSCode -------------------- diff --git a/cmake/YYCCVersion.hpp.in b/cmake/YYCCVersion.hpp.in new file mode 100644 index 0000000..ea51673 --- /dev/null +++ b/cmake/YYCCVersion.hpp.in @@ -0,0 +1,5 @@ +#pragma once + +#define YYCC_VER_MAJOR @PROJECT_VERSION_MAJOR@ +#define YYCC_VER_MINOR @PROJECT_VERSION_MINOR@ +#define YYCC_VER_PATCH @PROJECT_VERSION_PATCH@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0931b8..b59e82a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,10 @@ +# Configure version file +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/../cmake/YYCCVersion.hpp.in + ${CMAKE_CURRENT_LIST_DIR}/YYCC/YYCCVersion.hpp + @ONLY +) + # Create static library add_library(YYCCommonplace STATIC "") # Setup static library sources @@ -42,6 +49,7 @@ FILES YYCC/WinImportPrefix.hpp YYCC/WinImportSuffix.hpp # Internal + YYCC/YYCCVersion.hpp YYCC/YYCCInternal.hpp # Exposed YYCCommonplace.hpp diff --git a/src/YYCC/YYCCInternal.hpp b/src/YYCC/YYCCInternal.hpp index ba6f080..ba851da 100644 --- a/src/YYCC/YYCCInternal.hpp +++ b/src/YYCC/YYCCInternal.hpp @@ -2,9 +2,7 @@ #pragma region Library Version and Comparison Macros -#define YYCC_VER_MAJOR 1 -#define YYCC_VER_MINOR 3 -#define YYCC_VER_PATCH 0 +#include "YYCCVersion.hpp" /// @brief Return true if left version number is equal to right version number, otherwise false. #define YYCC_VERCMP_E(av1, av2, av3, bv1, bv2, bv3) ((av1) == (bv1) && (av2) == (bv2) && (av3) == (bv3))