[Bf-blender-cvs] [e9c548c3c31] master: CMake: fix error building with the version set to 300
Campbell Barton
noreply at git.blender.org
Tue Apr 13 09:43:36 CEST 2021
Commit: e9c548c3c3193f3a9cd45d78780efd8c9e2e9177
Author: Campbell Barton
Date: Tue Apr 13 17:37:59 2021 +1000
Branches: master
https://developer.blender.org/rBe9c548c3c3193f3a9cd45d78780efd8c9e2e9177
CMake: fix error building with the version set to 300
When Blender's minor version was single digits, it wasn't properly
extracted. Resolve by adding zero padding.
Issue raised by @harley in D10954.
===================================================================
M build_files/cmake/macros.cmake
===================================================================
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 813ac013cdf..91881441c95 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -923,6 +923,10 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
+ # Zero pad the minor version so `_out_version_minor` is always two characters.
+ # This is needed if the minor version is a single digit.
+ string(REGEX REPLACE "^([0-9])$" "0\\1" _out_version_minor "${_out_version_minor}")
+
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
More information about the Bf-blender-cvs
mailing list