From 497f53102c6996ad515841f8d05b9262d6e3897d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 10 Sep 2016 18:44:08 +0200 Subject: [PATCH] set version based on most recent tag --- s/build | 2 ++ src/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/s/build b/s/build index 1d580a349..611234dc0 100755 --- a/s/build +++ b/s/build @@ -42,5 +42,7 @@ fi echo "build eressea" cd $ROOT/$BUILD +VERSION=$(git describe --tags) +cmake -DERESSEA_VERSION="$VERSION" .. make $MAKEOPTS && make test cd $OLDPWD diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 118d88096..f1414c851 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,10 @@ include_directories (${TOLUA_INCLUDE_DIR}) include_directories (${BSON_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR}) +IF(DEFINED ERESSEA_VERSION) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DERESSEA_VERSION=\\\"${ERESSEA_VERSION}\\\"") +ENDIF() + IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")