From 7f6969bd57d6d892ad7cf97b94311d55f0957e56 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 22 Feb 2018 22:35:33 +0100 Subject: build: Deprecate version generation from git tag This deprecates the version generation from git tags. The version is now set in the CMakeLists.txt. This avoids wrong versions when checking out old commits and building the repository inside another repository. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 7 ++++--- cmake/GitVersionGen.cmake | 47 ----------------------------------------------- 2 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 cmake/GitVersionGen.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c5ea3bf1..acff38c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,11 +4,12 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") project(ouroboros C) -include(GitVersionGen) -git_version_gen() - include(GNUInstallDirs) +set(PACKAGE_VERSION_MAJOR 0) +set(PACKAGE_VERSION_MINOR 10) +set(PACKAGE_VERSION_PATCH 1) + set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") set(PACKAGE_URL "http://ouroboros.ilabt.imec.be") diff --git a/cmake/GitVersionGen.cmake b/cmake/GitVersionGen.cmake deleted file mode 100644 index 51d8c9b7..00000000 --- a/cmake/GitVersionGen.cmake +++ /dev/null @@ -1,47 +0,0 @@ -macro(git_version_gen) - - include(FindGit) - if (NOT GIT_FOUND) - message(FATAL_ERROR "This is not a git repository") - endif () - - find_program(SORT "sort") - mark_as_advanced(SORT) - if (${SORT} STREQUAL "") - message(FATAL_ERROR "Cannot find the sort executable") - endif () - - find_program(TAIL "tail") - mark_as_advanced(TAIL) - if (${TAIL} STREQUAL "") - message(FATAL_ERROR "Cannot find the tail executable") - endif () - - execute_process( - COMMAND ${GIT_EXECUTABLE} tag -l -n0 - COMMAND ${SORT} -V - COMMAND ${TAIL} -n 1 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE _git_tag - RESULT_VARIABLE _git_result - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (NOT ${_git_result} EQUAL 0) - message(FATAL_ERROR "Cannot fetch repository tag") - endif () - message(STATUS "Repository tag is: ${_git_tag}") - - string(REGEX REPLACE - "^([0-9]+)\\..*" "\\1" - _version_major "${_git_tag}") - string(REGEX REPLACE - "^[0-9]+\\.([0-9]+)\\..*" "\\1" - _version_minor "${_git_tag}") - string(REGEX REPLACE - "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" - _version_patch "${_git_tag}") - - set(PACKAGE_VERSION_MAJOR "${_version_major}") - set(PACKAGE_VERSION_MINOR "${_version_minor}") - set(PACKAGE_VERSION_PATCH "${_version_patch}") - -endmacro(git_version_gen) -- cgit v1.2.3