From c5a167543697af3cb4ef7884682d839abf7e8668 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Sep 2025 17:36:05 -0400 Subject: [PATCH] cmVersionMacros: Adopt CMake_VERSION_ENCODE --- Source/cmExportCMakeConfigGenerator.cxx | 2 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmVersion.h | 10 ---------- Source/cmVersionMacros.h | 10 ++++++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/cmExportCMakeConfigGenerator.cxx b/Source/cmExportCMakeConfigGenerator.cxx index 27eb31b571..f0980b4c34 100644 --- a/Source/cmExportCMakeConfigGenerator.cxx +++ b/Source/cmExportCMakeConfigGenerator.cxx @@ -26,7 +26,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmValue.h" -#include "cmVersion.h" +#include "cmVersionMacros.h" struct cmLinkInterface; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index c5af352f21..1b1cc542c1 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -43,7 +43,7 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" -#include "cmVersion.h" +#include "cmVersionMacros.h" #include "cmWindowsRegistry.h" #if defined(__HAIKU__) diff --git a/Source/cmVersion.h b/Source/cmVersion.h index c3d5b0cd4c..47d56acd40 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -2,8 +2,6 @@ file LICENSE.rst or https://cmake.org/licensing for details. */ #pragma once -#include - /** \class cmVersion * \brief Helper class for providing CMake and CTest version information. * @@ -21,11 +19,3 @@ public: static unsigned int GetTweakVersion(); static char const* GetCMakeVersion(); }; - -/* Encode with room for up to 1000 minor releases between major releases - and to encode dates until the year 10000 in the patch level. */ -#define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000) -#define CMake_VERSION_ENCODE(major, minor, patch) \ - ((((major) * 1000u) * CMake_VERSION_ENCODE_BASE) + \ - (((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \ - (((patch) % CMake_VERSION_ENCODE_BASE))) diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h index f89d8e7cc9..31612aeb1a 100644 --- a/Source/cmVersionMacros.h +++ b/Source/cmVersionMacros.h @@ -2,9 +2,19 @@ file LICENSE.rst or https://cmake.org/licensing for details. */ #pragma once +#include + #include "cmVersionConfig.h" #define CMake_VERSION_PATCH_IS_RELEASE(patch) ((patch) < 20000000) #if CMake_VERSION_PATCH_IS_RELEASE(CMake_VERSION_PATCH) # define CMake_VERSION_IS_RELEASE 1 #endif + +/* Encode with room for up to 1000 minor releases between major releases + and to encode dates until the year 10000 in the patch level. */ +#define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000) +#define CMake_VERSION_ENCODE(major, minor, patch) \ + ((((major) * 1000u) * CMake_VERSION_ENCODE_BASE) + \ + (((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \ + (((patch) % CMake_VERSION_ENCODE_BASE)))