diff --git a/CMakeLists.txt b/CMakeLists.txt index b9b33a5d..51cf9edd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,11 @@ cmake_minimum_required(VERSION 3.5.0) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/helpers.cmake) +set(MSG_PREFIX "etl |") determine_version_with_git(${GIT_DIR_LOOKUP_POLICY}) +if(NOT ETL_VERSION) + determine_version("version.txt") +endif() project(etl VERSION ${ETL_VERSION}) diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index 72e6017e..f27189d9 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -3,9 +3,9 @@ function(determine_version VER_FILE_NAME) # Remove trailing whitespaces and/or newline string(STRIP ${ETL_VERSION_RAW} ETL_VERSION) set(ETL_VERSION ${ETL_VERSION} CACHE STRING - "ETL version determined from version.txt" + "ETL version determined from version.txt" FORCE ) - message(STATUS "Determined ETL version ${ETL_VERSION} from version.txt file") + message(STATUS "${MSG_PREFIX} Determined ETL version ${ETL_VERSION} from version.txt file") endfunction() function(determine_version_with_git) @@ -16,7 +16,7 @@ function(determine_version_with_git) message(WARNING "Version string ${VERSION} retrieved with git describe is invalid") return() endif() - message(STATUS ${VERSION}) + message(STATUS "${MSG_PREFIX} Version string determined with git describe: ${VERSION}") # Parse the version information into pieces. string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}") string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}") @@ -25,7 +25,7 @@ function(determine_version_with_git) set(ETL_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") set(ETL_VERSION ${ETL_VERSION} CACHE STRING - "ETL version determined from version.txt" + "ETL version determined with git describe" FORCE ) - message(STATUS "Determined ETL version ${ETL_VERSION} from the git tag") + message(STATUS "${MSG_PREFIX} Determined ETL version ${ETL_VERSION} from the git tag") endfunction()