diff --git a/projectheader.cmake b/projectheader.cmake index 750268c..d3d0340 100644 --- a/projectheader.cmake +++ b/projectheader.cmake @@ -12,7 +12,16 @@ if(GIT_FOUND) execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE CURRENT_PROJECT_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE GIT_SUBMOD_RESULT) + + # Exit code will be 128 if no tags are present + if( ${GIT_SUBMOD_RESULT} EQUAL 128 ) + set(CURRENT_PROJECT_VERSION "0.0.1") + endif() + + + message( STATUS "================================================================" ) message( STATUS "Found the following tag : ${CURRENT_PROJECT_VERSION}") message( STATUS "================================================================" ) @@ -25,6 +34,7 @@ else() message( FATAL "Unable to determine the version of the software.") endif() + message( STATUS "" ) message( STATUS "================================================================" ) message( STATUS "Creating Makefile of ${CURRENT_PROJECT_NAME}" )