From f85ae9dc08f29ef082495bf4a7a904454eb6a0de Mon Sep 17 00:00:00 2001 From: Gerard Ryan Date: Sat, 31 Oct 2020 16:53:39 +1000 Subject: [PATCH] Added support for setting git version externally * This to help when building from source snapshots that typically don't have an entire repository. --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 332b361..3fce2ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,9 @@ execute_process( OUTPUT_VARIABLE git_dirty_check_out ) -if("${git_version_check_ret}" EQUAL 0) - set(tini_VERSION_GIT " - git.${tini_VERSION_GIT}") +if(NOT "${TINI_COMMIT}" STREQUAL "") + set(tini_VERSION_GIT "${TINI_COMMIT}") +elseif("${git_version_check_ret}" EQUAL 0) if(NOT "${git_dirty_check_out}" STREQUAL "") set(tini_VERSION_GIT "${tini_VERSION_GIT}-dirty") endif() @@ -36,6 +37,10 @@ else() set(tini_VERSION_GIT "") endif() +if(NOT ${tini_VERSION_GIT} STREQUAL "") + set(tini_VERSION_GIT " - git.${tini_VERSION_GIT}") +endif() + # Flags include(CheckCSourceCompiles)