From 7b7301eeffa22718588b118b53b80b6c5c139a29 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 12 Dec 2010 18:40:04 -0500 Subject: Made ./Config with a .git directory work ok if we are on a git tag --- Config | 9 +++++++-- include/CMakeLists.txt | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Config b/Config index c647c8e54..fa35b2d43 100755 --- a/Config +++ b/Config @@ -166,8 +166,13 @@ if [ ! "$NO_INTRO" ] ; then . $SOURCE_DIR/src/version.sh if [ -d .git ] ; then VERSION=`git describe --tags` - echo "#define VERSION_BUILD `echo "$VERSION" | cut -d'-' -f2`" > include/version.h - echo "#define VERSION_EXTRA \"-`echo "$VERSION" | cut -d'-' -f3`$VERSION_EXTRA\"" >> include/version.h + VERSION_BUILD=`echo "$VERSION" | cut -d'-' -f2` + VERSION_EXTRA=`echo "$VERSION" | cut -d'-' -f3` + if [ "$VERSION_BUILD" == "$VERSION_EXTRA" ] ; then + VERSION_EXTRA="" + fi + echo "#define VERSION_BUILD $VERSION_BUILD" > include/version.h + echo "#define VERSION_EXTRA \"$VERSION_EXTRA\"" >> include/version.h fi cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER echo "" diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b12d03598..c484334c1 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -12,6 +12,9 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h # Add version to list of files for CPack to ignore get_filename_component(version_BINARY ${version_BINARY} NAME) add_to_cpack_ignored_files("${version_BINARY}$" TRUE) +if(NOT WIN32) + add_to_cpack_ignored_files("version.h$" TRUE) +endif(NOT WIN32) # Add a custom target to the above file add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version.h) -- cgit