forked from wiiuse/wiiuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParseVersion.cmake
28 lines (24 loc) · 939 Bytes
/
ParseVersion.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set(_version_file "${CMAKE_CURRENT_SOURCE_DIR}/src/wiiuse.h")
if(EXISTS "${_version_file}")
file(READ "${_version_file}" _version_contents)
endif()
if("${_version_contents}" MATCHES "WIIUSE_MAJOR ([0-9]+)")
set(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CPACK_PACKAGE_VERSION_MAJOR "0")
message("Could not parse major version from wiiuse.h")
endif()
if("${_version_contents}" MATCHES "WIIUSE_MINOR ([0-9]+)")
set(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_1}")
else()
set(CPACK_PACKAGE_VERSION_MINOR "13")
message("Could not parse minor version from wiiuse.h")
endif()
if("${_version_contents}" MATCHES "WIIUSE_MICRO ([0-9]+)")
set(CPACK_PACKAGE_VERSION_MICRO "${CMAKE_MATCH_1}")
else()
set(CPACK_PACKAGE_VERSION_MICRO "0")
message("Could not parse micro version from wiiuse.h")
endif()
set(CPACK_PACKAGE_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_MICRO}")