Commit 586e5e7b9b4e4bcfd932ef43fe45278371e3e14a

Authored by Peter M. Groen
1 parent 83d7bf32

Fix for branch not having a tag..

Showing 1 changed file with 11 additions and 1 deletions
projectheader.cmake
@@ -12,7 +12,16 @@ if(GIT_FOUND) @@ -12,7 +12,16 @@ if(GIT_FOUND)
12 execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags 12 execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags
13 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 13 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
14 OUTPUT_VARIABLE CURRENT_PROJECT_VERSION 14 OUTPUT_VARIABLE CURRENT_PROJECT_VERSION
15 - OUTPUT_STRIP_TRAILING_WHITESPACE) 15 + OUTPUT_STRIP_TRAILING_WHITESPACE
  16 + RESULT_VARIABLE GIT_SUBMOD_RESULT)
  17 +
  18 + # Exit code will be 128 if no tags are present
  19 + if( ${GIT_SUBMOD_RESULT} EQUAL 128 )
  20 + set(CURRENT_PROJECT_VERSION "0.0.1")
  21 + endif()
  22 +
  23 +
  24 +
16 message( STATUS "================================================================" ) 25 message( STATUS "================================================================" )
17 message( STATUS "Found the following tag : ${CURRENT_PROJECT_VERSION}") 26 message( STATUS "Found the following tag : ${CURRENT_PROJECT_VERSION}")
18 message( STATUS "================================================================" ) 27 message( STATUS "================================================================" )
@@ -25,6 +34,7 @@ else() @@ -25,6 +34,7 @@ else()
25 message( FATAL "Unable to determine the version of the software.") 34 message( FATAL "Unable to determine the version of the software.")
26 endif() 35 endif()
27 36
  37 +
28 message( STATUS "" ) 38 message( STATUS "" )
29 message( STATUS "================================================================" ) 39 message( STATUS "================================================================" )
30 message( STATUS "Creating Makefile of ${CURRENT_PROJECT_NAME}" ) 40 message( STATUS "Creating Makefile of ${CURRENT_PROJECT_NAME}" )