@@ -37,24 +37,25 @@ set(PF_VERSION_DIRTY "")
3737# Find and set the Parameter Framework's version
3838# First, let's see if the user forced a version (i.e. "vX.Y.Z-N")
3939if (NOT DEFINED PF_VERSION)
40- # Else, try to get it from git
41- execute_process (COMMAND git describe --tags --long --dirty --abbrev=12
42- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
43- OUTPUT_VARIABLE PF_VERSION
44- RESULT_VARIABLE GIT_DESCRIBE_RESULT
45- OUTPUT_STRIP_TRAILING_WHITESPACE
46- ERROR_QUIET)
4740
48- if (GIT_DESCRIBE_RESULT GREATER 0)
49- # Or fall back to reading it from .version (this will happen when
50- # building from an archive)
51- file (READ "${PROJECT_SOURCE_DIR} /.version" PF_VERSION_FILE_CONTENT)
41+ # Else, try to get it from .version (this will happen when
42+ # building from an archive)
43+ file (READ "${PROJECT_SOURCE_DIR} /.version" PF_VERSION_FILE_CONTENT)
5244
53- set (REGEX "tag: (v[0-9.]+)" )
54- if (PF_VERSION_FILE_CONTENT MATCHES ${REGEX} )
55- set (PF_VERSION "${CMAKE_MATCH_1} -0" )
56- endif ()
45+ set (REGEX "tag: (v[0-9.]+)" )
46+ if (PF_VERSION_FILE_CONTENT MATCHES ${REGEX} )
47+ set (PF_VERSION "${CMAKE_MATCH_1} -0" )
48+
49+ else ()
50+ # Or fall back from git
51+ execute_process (COMMAND git describe --tags --long --dirty --abbrev=12
52+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
53+ OUTPUT_VARIABLE PF_VERSION
54+ RESULT_VARIABLE GIT_DESCRIBE_RESULT
55+ OUTPUT_STRIP_TRAILING_WHITESPACE
56+ ERROR_QUIET)
5757 endif ()
58+
5859else ()
5960 # Set the "nice version string" to the one forced by the user
6061 set (NICE_PF_VERSION "${PF_VERSION} " )
@@ -73,6 +74,11 @@ endif()
7374
7475# If we are precisely on a tag, make a nicer version string (unless otherwise
7576# forced by the user - see above)
76- if ((NOT DEFINED NICE_PF_VERSION) AND (PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
77- set (NICE_PF_VERSION "v${PF_VERSION_MAJOR} .${PF_VERSION_MINOR} .${PF_VERSION_PATCH} " )
77+ if ((NOT DEFINED NICE_PF_VERSION))
78+ if ((PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
79+ set (NICE_PF_VERSION "v${PF_VERSION_MAJOR} .${PF_VERSION_MINOR} .${PF_VERSION_PATCH} " )
80+ else ()
81+ # Fallback
82+ set (NICE_PF_VERSION "${PF_VERSION} " )
83+ endif ()
7884endif ()
0 commit comments