function(parse_version version var_prefix)
	string(REGEX MATCH "^(([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*))$" version_matches "${version}")
	if(CMAKE_MATCH_0)
		set(full ${CMAKE_MATCH_1})
		set(major ${CMAKE_MATCH_2})
		set(minor ${CMAKE_MATCH_3})
		set(patch ${CMAKE_MATCH_4})
		set(age ${CMAKE_MATCH_5})

		set(snapshot)
		if(age MATCHES "SNAPSHOT")
			set(snapshot "snapshot")
		endif()
		#message("parse_version(${version}, ${var_prefix}) => ${major}.${minor}.${patch}${snapshot}")
		set(${var_prefix}_VERSION "${major}.${minor}.${patch}${snapshot}" PARENT_SCOPE)
		set(${var_prefix}_VERSION_MAJOR ${major} PARENT_SCOPE)
		set(${var_prefix}_VERSION_MINOR ${minor} PARENT_SCOPE)
		set(${var_prefix}_VERSION_PATCH ${patch} PARENT_SCOPE)
	endif()
endfunction()
