create_revision.sh: better

This commit is contained in:
Pavel Kartavyy 2015-01-13 11:08:12 +03:00
parent ad5fdc0e62
commit 982c2c5573

View File

@ -1,7 +1,7 @@
#!/bin/bash
mkdir -p "${CMAKE_CURRENT_BINARY_DIR}"/src
echo "#ifndef REVISION" > ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h
echo -n "#define REVISION " >> ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h
mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/src"
echo "#ifndef REVISION" > "${CMAKE_CURRENT_BINARY_DIR}/src/revision.h"
echo -n "#define REVISION " >> "${CMAKE_CURRENT_BINARY_DIR}/src/revision.h"
cd "${CMAKE_CURRENT_SOURCE_DIR}";
@ -15,6 +15,6 @@ revision=$(git tag --points-at HEAD 2> /dev/null | tail -1)
if [[ "$revision" = "" ]]; then
revision=$( ( git describe --tags || echo 1 ) | cut -d "-" -f 1 )
fi
echo $revision >> "${CMAKE_CURRENT_BINARY_DIR}"/src/revision.h;
echo $revision >> "${CMAKE_CURRENT_BINARY_DIR}/src/revision.h";
echo "#endif" >> "${CMAKE_CURRENT_BINARY_DIR}"/src/revision.h
echo "#endif" >> "${CMAKE_CURRENT_BINARY_DIR}/src/revision.h"