-Updated CMake, version auto-generated. Fixes #69

This commit is contained in:
Harry van Haaren 2014-02-23 18:16:53 +00:00
parent abff10a08e
commit 738da63d9f
4 changed files with 15 additions and 11 deletions

View file

@ -3,9 +3,11 @@ cmake_minimum_required (VERSION 2.6)
project (LUPPP)
set (LUPPP_VERSION_MAJOR 1)
set (LUPPP_VERSION_MINOR 0)
set(LUPPP_VERSION_MAJOR "1")
set(LUPPP_VERSION_MINOR "0")
set(LUPPP_VERSION_PATCH "1")
set(LUPPP_VERSION "${LUPPP_VERSION_MAJOR}.${LUPPP_VERSION_MINOR}.${LUPPP_VERSION_PATCH}")
option(BUILD_TESTS "Build test version" OFF)
@ -17,4 +19,13 @@ option(BUILD_TESTS "Build test version" OFF)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#execute_process(COMMAND "date +\"%d-%m-%Y\"` `git log --pretty=format:\"%h\" | head -n1`"
#execute_process(COMMAND "git log --pretty=format:\"%h\" | head -n1"
execute_process(COMMAND git log --oneline -n1
OUTPUT_VARIABLE _output OUTPUT_STRIP_TRAILING_WHITESPACE)
file(WRITE src/version.hxx "#define GIT_VERSION \"${_output}\"")
add_subdirectory (src)

View file

@ -46,7 +46,7 @@ ENDIF(RELEASE_BUILD)
FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx tests/*.cxx)
# Compile binary
add_executable (luppp ${sources} )
add_executable (luppp version.hxx ${sources} )
# Linking

View file

@ -58,7 +58,7 @@ static void gui_static_loadSession_cb(void* inst)
int main(int argc, char** argv)
{
LUPPP_NOTE("%s", GIT_VERSION );
LUPPP_NOTE("Git: %s", GIT_VERSION );
bool runTests;
if ( runTests ){} // remove unused warning if not built with BUILD_TESTS

View file

@ -1,7 +0,0 @@
#!/bin/bash
# this file writes src/version.h from the git commit
echo "
#ifndef GIT_VERSION
#define GIT_VERSION \"`date +\"%d-%m-%Y\"` `git log --pretty=format:"%h" | head -n1`\"
#endif" > src/version.hxx