Permalink
Browse files

More DRY for version handling.

No more duplication and out of sync of version information.
  • Loading branch information...
1 parent 104b79d commit f0f57fee44a1578f9fd3998b16bf3cb734f06ec2 @marco-m marco-m committed Dec 23, 2012
Showing with 19 additions and 3 deletions.
  1. +17 −1 config/Macros.cmake
  2. +2 −2 src/client/CMakeLists.txt
View
@@ -36,7 +36,23 @@ macro ( strip_lib target )
endif ( )
endmacro ( )
-macro ( generate_win32_resource resfile FULLNAME INTERNALNAME DESCRIPTION COMMENT COPYRIGHT VERSION_MAJOR VERSION_MINOR VERSION_BUG )
+# "0.7.0" -> 0 7 0
+function(split_version version major minor bug)
+ # Transform the string in a list
+ string(REPLACE "." ";" version_list ${version})
+ # Extract the elements
+ list(GET version_list 0 ma)
+ list(GET version_list 1 mi)
+ list(GET version_list 2 bu)
+ # Assign the function parameters
+ set(${major} ${ma} PARENT_SCOPE)
+ set(${minor} ${mi} PARENT_SCOPE)
+ set(${bug} ${bu} PARENT_SCOPE)
+endfunction()
+
+macro ( generate_win32_resource resfile FULLNAME INTERNALNAME DESCRIPTION COMMENT COPYRIGHT VERSION )
+ split_version(${VERSION} VERSION_MAJOR VERSION_MINOR VERSION_BUG)
+ message("+++ ${VERSION_MAJOR} ${VERSION_MINOR} ${VERSION_BUG}")
if ( WIN32 )
set ( win32RC ${CMAKE_CURRENT_BINARY_DIR}/win32resource.rc )
if ( ${CMAKE_CURRENT_LIST_FILE} IS_NEWER_THAN ${win32RC} )
@@ -101,9 +101,9 @@ if ( WIN32 )
"DrawPile client" # full name
${CLIENTNAME} # internal name
"DrawPile client"
- "http://drawpile.sourceforge.net/"
+ ${WEBSITE}
"2006-2008 Calle Laakkonen"
- 0 6 0
+ ${DRAWPILE_VERSION}
)
endif ( WIN32 )

0 comments on commit f0f57fe

Please sign in to comment.