diff options
author | Bernd Wachter <bwachter-tmw@lart.info> | 2010-01-25 19:21:44 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-01-25 21:29:29 +0100 |
commit | c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf (patch) | |
tree | 79546576ded471713e0e964daf00a805bd59911a | |
parent | 27d88d22e57cd348c4dd28201942a043ac2d5054 (diff) | |
download | mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.gz mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.bz2 mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.xz mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.zip |
Allow version overriding by CMake parameters, autogenerate winver.h
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/winver.h.in | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d9238d2..48e63788 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(MANA) -SET(VERSION 0.0.29.1) +IF (NOT VERSION) + SET(VERSION 0.1.0.0) +ENDIF() # where to look for cmake modules SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) @@ -16,6 +18,17 @@ IF (WIN32) SET(PKG_DATADIR ".") SET(PKG_BINDIR ".") SET(LOCALEDIR ".") + STRING(REPLACE "." " " _VERSION ${VERSION}) + SEPARATE_ARGUMENTS(_VERSION) + LIST(LENGTH _VERSION _LEN) + IF(NOT _LEN EQUAL 4) + MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE.BUILD") + ENDIF() + LIST(GET _VERSION 0 VER_MAJOR) + LIST(GET _VERSION 1 VER_MINOR) + LIST(GET _VERSION 2 VER_RELEASE) + LIST(GET _VERSION 3 VER_BUILD) + CONFIGURE_FILE(src/winver.h.in src/winver.h) ELSE (WIN32) SET(PKG_DATADIR ${CMAKE_INSTALL_PREFIX}/share/mana) SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) diff --git a/src/winver.h.in b/src/winver.h.in new file mode 100644 index 00000000..fb0aac2c --- /dev/null +++ b/src/winver.h.in @@ -0,0 +1,6 @@ +/* VERSION DEFINITIONS */ +#define VER_MAJOR ${VER_MAJOR} +#define VER_MINOR ${VER_MINOR} +#define VER_RELEASE ${VER_RELEASE} +#define VER_BUILD ${VER_BUILD} +#define PACKAGE_VERSION "${VERSION}" |