Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-02-25 10:15:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-25 10:15:54 +0300
commit83caabebd2cc0d09862cd8818094f32c97c69b09 (patch)
treeaa11b6b9d148c1f0888d84a6412d68d3bd7ff6f0 /build_files
parent37556d9a9ae198ff35853e13dcfebb281b2c04e6 (diff)
CMake: error making get_blender_version a function
Incorrect use of PARENT_SCOPE meant the vars would be used uninitialized elsewhere.
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/macros.cmake36
1 files changed, 24 insertions, 12 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5624941f2f7..220199bea38 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1015,6 +1015,15 @@ macro(ADD_CHECK_CXX_COMPILER_FLAG
endmacro()
function(get_blender_version)
+ # extracts header vars and defines them in the parent scope:
+ #
+ # - BLENDER_VERSION (major.minor)
+ # - BLENDER_VERSION_MAJOR
+ # - BLENDER_VERSION_MINOR
+ # - BLENDER_SUBVERSION (used for internal versioning mainly)
+ # - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
+ # - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
+
# So cmake depends on BKE_blender.h, beware of inf-loops!
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done)
@@ -1047,25 +1056,28 @@ function(get_blender_version)
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE")
endif()
- math(EXPR BLENDER_VERSION_MAJOR "${_out_version} / 100")
- math(EXPR BLENDER_VERSION_MINOR "${_out_version} % 100")
- set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}" PARENT_SCOPE)
-
- set(BLENDER_SUBVERSION ${_out_subversion} PARENT_SCOPE)
- set(BLENDER_VERSION_CHAR ${_out_version_char} PARENT_SCOPE)
- set(BLENDER_VERSION_CYCLE ${_out_version_cycle} PARENT_SCOPE)
+ math(EXPR _out_version_major "${_out_version} / 100")
+ math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
- string(COMPARE EQUAL "${BLENDER_VERSION_CHAR}" "" _out_version_char_empty)
+ string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
- set(BLENDER_VERSION_CHAR_INDEX "0" PARENT_SCOPE)
+ set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
- list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index)
- math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1" PARENT_SCOPE)
+ list(FIND _char_ls ${_out_version_char} _out_version_char_index)
+ math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
- # message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
+ # output vars
+ set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
+ set(BLENDER_VERSION_MAJOR "${_out_subversion}" PARENT_SCOPE)
+ set(BLENDER_VERSION_MINOR "${_out_subversion}" PARENT_SCOPE)
+ set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
+ set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
+ set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
+ set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
+
endfunction()