Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find GIT in Windows #77

Closed
bkochuna opened this issue Jul 15, 2015 · 2 comments
Closed

Cannot find GIT in Windows #77

bkochuna opened this issue Jul 15, 2015 · 2 comments

Comments

@bkochuna
Copy link
Contributor

In Windows TriBITS is unable to locate the git executable. This causes a configure failure when the generation of RepoVersion.txt is enabled.

EDIT: The git format-patch commit is below.

@bkochuna
Copy link
Contributor Author

From fee7109f249ec897446377c307cbfa6bf91aa63c Mon Sep 17 00:00:00 2001
From: Brendan Kochunas <[email protected]>
Date: Wed, 15 Jul 2015 13:26:03 -0400
Subject: [PATCH] Fixing issue with finding git in Windows

---
 tribits/core/package_arch/TribitsConstants.cmake   |   11 -----------
 .../core/package_arch/TribitsGlobalMacros.cmake    |   15 +++++++++++++--
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tribits/core/package_arch/TribitsConstants.cmake b/tribits/core/package_arch/TribitsConstants.cmake
index b628bf4..a4fc902 100644
--- a/tribits/core/package_arch/TribitsConstants.cmake
+++ b/tribits/core/package_arch/TribitsConstants.cmake
@@ -77,14 +77,3 @@ SET(${PROJECT_NAME}_CDASH_SUBPROJECT_DEPS_XML_FILE_NAME CDashSubprojectDependenc
 SET(${PROJECT_NAME}_PACKAGE_DEPS_TABLE_HTML_FILE_NAME ${PROJECT_NAME}PackageDependenciesTable.html)

 SET(${PROJECT_NAME}_PACKAGE_DEPS_FILES_DIR "cmake/dependencies")
-
-# Other stuff
-
-IF(WIN32)
-  #Apparently FIND_PROGRAM looks for an exact match of the file name.
-  #So even though "git clone ..." is valid to use on windows we need to give the
-  #full name of the command we want to run.
-  SET(GIT_NAME git.cmd)
-ELSE(WIN32)
-  SET(GIT_NAME git)
-ENDIF(WIN32)
diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake
index 09afbc5..1f9b0c5 100644
--- a/tribits/core/package_arch/TribitsGlobalMacros.cmake
+++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake
@@ -921,7 +921,7 @@ FUNCTION(TRIBITS_GENERATE_SINGLE_REPO_VERSION_STRING  GIT_REPO_DIR
   )

   IF (NOT GIT_EXEC)
-    MESSAGE(SEND_ERROR "ERROR, the program '${GIT_NAME}' could not be found!"
+    MESSAGE(SEND_ERROR "ERROR, the program git could not be found!"
       "  We can not generate the repo version file!")
   ENDIF()

@@ -1085,7 +1085,18 @@ FUNCTION(TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE_AND_INSTALL)
     IF (PROJECT_SOURCE_IS_GIT_REPO)
       # Find git first here so we  don't have to find it in called function so
       # it can be unit tested.
-      FIND_PROGRAM(GIT_EXEC ${GIT_NAME})
+      FIND_PROGRAM(GIT_EXEC git)
+
+      #If git was not found and the OS is Windows try again with some hints
+      IF(NOT GIT_EXEC AND WIN32)
+        FIND_PROGRAM(
+          GIT_EXEC git.exe
+          HINTS
+            "C:/Program Files/Git/bin"
+            "C:/Program Files (x86)/Git/bin"
+        )
+      ENDIF()
+
       # Get repo versions, print to stdout and write file
       TRIBITS_GENERATE_REPO_VERSION_OUTPUT_AND_FILE()
       # Add install target for this file
--
1.7.9.5

@bartlettroscoe
Copy link
Member

I think this got fixed a long time ago in commit acd84d9. Closing as complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants