summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2011-10-20 19:49:00 -0700
committerJosh Blum2011-10-20 19:49:00 -0700
commite44d194f944aa0a66a543286a36fa05c34c4db3e (patch)
tree6b6018419a065f9b3b8ce537c364c5fbf319a1d9
parent1c95e89b0eafe063770ff98ee09f566843d1a68c (diff)
downloadgnuradio-e44d194f944aa0a66a543286a36fa05c34c4db3e.tar.gz
gnuradio-e44d194f944aa0a66a543286a36fa05c34c4db3e.tar.bz2
gnuradio-e44d194f944aa0a66a543286a36fa05c34c4db3e.zip
cmake: more tweaks for version extraction when git not found
-rw-r--r--cmake/Modules/GrVersion.cmake18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake
index 79aa3e4b0..16338f143 100644
--- a/cmake/Modules/GrVersion.cmake
+++ b/cmake/Modules/GrVersion.cmake
@@ -25,6 +25,7 @@ set(__INCLUDED_GR_VERSION_CMAKE TRUE)
########################################################################
# Extract variables from version.sh
########################################################################
+include(GrPython)
message(STATUS "Extracting version information from version.sh...")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "print open('${CMAKE_SOURCE_DIR}/version.sh').read().replace('=', ';').replace('\\n', ';')"
OUTPUT_VARIABLE VERSION_INFO OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -43,16 +44,16 @@ set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION})
########################################################################
find_package(Git)
-unset(GIT_DESCRIBE)
-
-if(GIT_FOUND)
+if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
message(STATUS "Extracting version information from git describe...")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8
OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
-endif(GIT_FOUND)
+else()
+ set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
+endif()
########################################################################
# Parse the git describe string (currently unused)
@@ -64,7 +65,7 @@ unset(GIT_COMMIT)
if(GIT_DESCRIBE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c
- "import re; print ';'.join(re.match('^v(.*)-(.*)-g(.*)$', '${GIT_DESCRIBE}').groups())"
+ "import re; print ';'.join(re.match('^v(.*)-(.*)-\\w(.*)$', '${GIT_DESCRIBE}').groups())"
OUTPUT_VARIABLE GIT_DESCRIBES OUTPUT_STRIP_TRAILING_WHITESPACE
)
list(GET GIT_DESCRIBES 0 GIT_TAG)
@@ -94,9 +95,10 @@ else()
# VERSION: 3.3.1{.x}
# DOCVER: 3.3.1{.x}
# LIBVER: 3.3.1{.x}
- set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}")
- if("${MAINT_VERSION}" NOT STREQUAL "0")
- set(VERSION "${VERSION}.${MAINT_VERSION}")
+ if("${MAINT_VERSION}" STREQUAL "0")
+ set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}")
+ else()
+ set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}")
endif()
set(DOCVER "${VERSION}")
set(LIBVER "${VERSION}")