From: Denis Davydov Date: Wed, 24 May 2017 05:47:17 +0000 (+0200) Subject: install git scripts and use get_latest_tag.sh to get Git tag X-Git-Tag: v9.0.0-rc1~1576^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4407%2Fhead;p=dealii.git install git scripts and use get_latest_tag.sh to get Git tag --- diff --git a/cmake/macros/macro_deal_ii_query_git_information.cmake b/cmake/macros/macro_deal_ii_query_git_information.cmake index 32354ac211..d6c25e34d1 100644 --- a/cmake/macros/macro_deal_ii_query_git_information.cmake +++ b/cmake/macros/macro_deal_ii_query_git_information.cmake @@ -109,24 +109,25 @@ MACRO(DEAL_II_QUERY_GIT_INFORMATION) # # Query for tag: # - - EXECUTE_PROCESS( - COMMAND ${GIT_EXECUTABLE} rev-list --tags --max-count=1 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE _tag - RESULT_VARIABLE _result - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - EXECUTE_PROCESS( - COMMAND ${GIT_EXECUTABLE} describe --tags ${_tag} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE _tag - RESULT_VARIABLE _result - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF(${_result} EQUAL 0) - SET(${_prefix}GIT_TAG ${_tag}) + SET(_script "") + IF(EXISTS ${CMAKE_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/scripts/get_latest_tag.sh) + SET(_script ${CMAKE_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/scripts/get_latest_tag.sh) + ELSEIF(EXISTS ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/get_latest_tag.sh) + SET(_script ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/get_latest_tag.sh) + ENDIF() + IF(NOT "${_script}" STREQUAL "") + EXECUTE_PROCESS( + COMMAND ${_script} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE _tag + RESULT_VARIABLE _result + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(${_result} EQUAL 0) + SET(${_prefix}GIT_TAG ${_tag}) + ENDIF() + ELSE() + MESSAGE(STATUS "Could not locate get_latest_tag.sh. " ${_prefix}GIT_TAG " will not be set.") ENDIF() ENDIF() diff --git a/cmake/scripts/CMakeLists.txt b/cmake/scripts/CMakeLists.txt index 565f1c0eee..24ec784f44 100644 --- a/cmake/scripts/CMakeLists.txt +++ b/cmake/scripts/CMakeLists.txt @@ -49,6 +49,8 @@ SET(_scripts ${CMAKE_CURRENT_SOURCE_DIR}/normalize.pl ${CMAKE_CURRENT_SOURCE_DIR}/run_test.cmake ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh + ${CMAKE_CURRENT_SOURCE_DIR}/get_closest_tag.sh + ${CMAKE_CURRENT_SOURCE_DIR}/get_latest_tag.sh ) FILE(COPY ${_scripts} DESTINATION ${CMAKE_BINARY_DIR}/${DEAL_II_SHARE_RELDIR}/scripts