From ad06e9cc75d71f51d1033e54a38e1315fe422c8b Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 5 Jul 2022 01:01:58 +0200 Subject: [PATCH] code: Fix errors hidden by parent scope leaking into function The variable scope in CMake is unlike other languages, and simply prevents functions from unintentionally polluting the parent scope. Unfortunately this also means that we need to take extra measurements to guarantee a good default state, and that 'DEFINED' is a useless keyword. Therefore by using a random prefix, we can prevent unintentional pollution of the function scope by the caller. --- version.cmake | 318 +++++++++++++++++++++++++++++--------------------- 1 file changed, 183 insertions(+), 135 deletions(-) diff --git a/version.cmake b/version.cmake index eaba570..0c75a7e 100644 --- a/version.cmake +++ b/version.cmake @@ -89,10 +89,13 @@ Compares the version ```` against ```` and stores the result in ``MAJOR" PARENT_SCOPE) return() - elseif(_A_MAJOR LESS _B_MAJOR) + elseif(_00fdeadb_MAJOR LESS _ca75feel_MAJOR) set(${OUT_VAR} "MINOR" PARENT_SCOPE) return() - elseif(_A_MINOR LESS _B_MINOR) + elseif(_00fdeadb_MINOR LESS _ca75feel_MINOR) set(${OUT_VAR} "PATCH" PARENT_SCOPE) return() - elseif(_A_PATCH LESS _B_PATCH) + elseif(_00fdeadb_PATCH LESS _ca75feel_PATCH) set(${OUT_VAR} "TWEAK" PARENT_SCOPE) return() - elseif(_A_TWEAK LESS _B_TWEAK) + elseif(_00fdeadb_TWEAK LESS _ca75feel_TWEAK) set(${OUT_VAR} "