[Bf-blender-cvs] [83caabe] master: CMake: error making get_blender_version a function

Campbell Barton noreply at git.blender.org
Wed Feb 25 08:18:26 CET 2015


Commit: 83caabebd2cc0d09862cd8818094f32c97c69b09
Author: Campbell Barton
Date:   Wed Feb 25 18:15:54 2015 +1100
Branches: master
https://developer.blender.org/rB83caabebd2cc0d09862cd8818094f32c97c69b09

CMake: error making get_blender_version a function

Incorrect use of PARENT_SCOPE meant the vars would be used uninitialized elsewhere.

===================================================================

M	build_files/cmake/macros.cmake
M	intern/glew-mx/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5624941..220199b 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()
 
 
diff --git a/intern/glew-mx/CMakeLists.txt b/intern/glew-mx/CMakeLists.txt
index bdb3925..8b692b5 100644
--- a/intern/glew-mx/CMakeLists.txt
+++ b/intern/glew-mx/CMakeLists.txt
@@ -25,6 +25,9 @@
 
 set(INC
 	.
+)
+
+set(INC_SYS
 	${GLEW_INCLUDE_PATH}
 )




More information about the Bf-blender-cvs mailing list