CMake: error making get_blender_version a function
Incorrect use of PARENT_SCOPE meant the vars would be used uninitialized elsewhere.
This commit is contained in:
parent
37556d9a9a
commit
83caabebd2
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
set(INC
|
||||
.
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
${GLEW_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue