summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2010-01-25 19:21:44 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-01-25 21:29:29 +0100
commitc1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf (patch)
tree79546576ded471713e0e964daf00a805bd59911a /CMakeLists.txt
parent27d88d22e57cd348c4dd28201942a043ac2d5054 (diff)
downloadmana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.gz
mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.bz2
mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.tar.xz
mana-c1ac8aa8dc81bfcc06d7928ca974ec1a941c7adf.zip
Allow version overriding by CMake parameters, autogenerate winver.h
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 14 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)