From 9a7405191f98f6d641c79bed34171b5c4bc3b8ea Mon Sep 17 00:00:00 2001 From: "Karl W. Schulz" Date: Mon, 12 Dec 2022 14:07:05 -0500 Subject: [PATCH] Only update template VERSION.sha file when running within git clone. Fixes #53. Signed-off-by: Karl W. Schulz [ROCm/rocprofiler-compute commit: 2f04b5b6b19a1d90c5b2d5acfb0c73ef831aa4f3] --- projects/rocprofiler-compute/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/rocprofiler-compute/CMakeLists.txt b/projects/rocprofiler-compute/CMakeLists.txt index 89a0dbb7a3..ac5dd2feb9 100644 --- a/projects/rocprofiler-compute/CMakeLists.txt +++ b/projects/rocprofiler-compute/CMakeLists.txt @@ -35,13 +35,15 @@ include(GNUInstallDirs) # version control info find_package(Git) - if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") execute_process( COMMAND git log --pretty=format:%h -n 1 OUTPUT_VARIABLE OMNIPERF_GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "Git revision: ${OMNIPERF_GIT_REV}") + set(GIT_CLONE TRUE) +else() + set(GIT_CLONE FALSER) endif() set(CMAKE_BUILD_TYPE "Release") @@ -163,8 +165,10 @@ if(LOCALHOST MATCHES "TheraS01|.*\.thera\.amd\.com|thera-hn") endif() # git versioning file -configure_file(${PROJECT_SOURCE_DIR}/cmake/VERSION.sha.in - ${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY) +if(${GIT_CLONE}) + configure_file(${PROJECT_SOURCE_DIR}/cmake/VERSION.sha.in + ${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY) +endif() enable_testing()