Skip to content
Snippets Groups Projects
Commit ee317adc authored by Lars Bilke's avatar Lars Bilke
Browse files

Better git finding on Windows.

parent 68a4f0d8
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,13 @@ FIND_PACKAGE(PythonInterp QUIET)
FIND_PACKAGE(GitHub)
FIND_PROGRAM(GIT_TOOL_PATH git HINTS ${GITHUB_BIN_DIR} DOC "The git command line interface")
IF(NOT GIT_TOOL_PATH)
IF(WIN32)
MESSAGE(FATAL_ERROR "Git not found! Please install GitHub for Windows or Git!")
ELSE()
MESSAGE(FATAL_ERROR "Git not found but is required!")
ENDIF()
ENDIF()
# Find bash itself ...
FIND_PROGRAM(BASH_TOOL_PATH bash
......
......@@ -13,25 +13,24 @@ IF(WIN32 AND NOT GITHUB_FOUND)
FIND_PATH(
GITHUB_DIR
shell.ps1
PATHS $ENV{LOCALAPPDATA}/GitHub
PATHS $ENV{LOCALAPPDATA}/GitHub $ENV{GitHub_DIR}
NO_DEFAULT_PATH
)
IF(GITHUB_DIR)
FILE(TO_NATIVE_PATH ${GITHUB_DIR} GITHUB_WIN_DIR)
EXECUTE_PROCESS (
COMMAND cmd /c "cd ${GITHUB_WIN_DIR}/PortableGit* & cd"
COMMAND cmd /c "cd ${GITHUB_DIR}/PortableGit*/bin & cd"
OUTPUT_VARIABLE PORTABLE_GIT_WIN_DIR
)
IF(PORTABLE_GIT_WIN_DIR)
STRING(STRIP ${PORTABLE_GIT_WIN_DIR} PORTABLE_GIT_WIN_DIR)
FILE(TO_CMAKE_PATH ${PORTABLE_GIT_WIN_DIR} PORTABLE_GIT_DIR)
FILE(TO_CMAKE_PATH ${PORTABLE_GIT_WIN_DIR} PORTABLE_GIT_WIN_DIR)
SET(GITHUB_FOUND ON CACHE BOOL "Was GitHub for Windows found?")
SET(GITHUB_BIN_DIR ${PORTABLE_GIT_DIR}/bin CACHE PATH "The path to the GitHub for Windows binaries.")
SET(GITHUB_BIN_DIR ${PORTABLE_GIT_WIN_DIR} CACHE PATH "The path to the GitHub for Windows binaries." FORCE)
MESSAGE(STATUS "GitHub for Windows found.")
ENDIF()
ENDIF()
ENDIF()
\ No newline at end of file
ENDIF()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment