summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.9.0.patch
blob: 2bb5074df27181a63ecec104cb0e9a653fa1fc9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From db2a538d9beaef9092dff19c36ed8a2e291bc69a Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <harmenstoppels@gmail.com>
Date: Mon, 11 Jan 2021 16:38:14 +0100
Subject: [PATCH 1/2] Improve compilation without git repo

---
 CMakeLists.txt | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f5bdad9..ca0e7ed4 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,9 +44,17 @@ string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
 list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
 list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
 
-find_package(Git)
+# only look for git when we have a git repo
+if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
+  find_package(Git)
+endif()
 
 # FIXME: Two different version strings used.
+
+set(HIP_PACKAGING_VERSION_PATCH "0")
+set(HIP_VERSION_GITDATE "0")
+set(HIP_VERSION_PATCH "0")
+
 if(GIT_FOUND)
   # get date information based on UTC
   # use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
@@ -90,9 +98,6 @@ if(GIT_FOUND)
   else()
     set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}-${HIP_VERSION_GITHASH})
   endif()
-else()
-  # FIXME: Some parts depend on this being set.
-  set(HIP_PACKAGING_VERSION_PATCH "0")
 endif()
 
 add_to_config(_versionInfo HIP_VERSION_MAJOR)
@@ -447,10 +452,6 @@ endif()
 # Generate .hipVersion
 file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
 
-if(NOT DEFINED HIP_VERSION_GITDATE)
-  set(HIP_VERSION_GITDATE 0)
-endif()
-
 # Generate hip_version.h
 set(_versionInfoHeader
 "// Auto-generated by cmake\n
-- 
2.25.1