Created
May 28, 2010 16:54
-
-
Save jcfr/417411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------------------------------------- | |
project(TestGitCmd) | |
#----------------------------------------------------------------------------- | |
#----------------------------------------------------------------------------- | |
cmake_minimum_required(VERSION 2.8) | |
#----------------------------------------------------------------------------- | |
find_program(git_EXECUTABLE | |
NAMES git.cmd git eg.cmd eg | |
PATHS | |
"C:/Program Files/Git/bin" | |
"C:/Program Files (x86)/Git/bin" | |
DOC "git command line client") | |
if (NOT git_EXECUTABLE) | |
message(FATAL_ERROR "git_EXECUTABLE not found !") | |
endif() | |
set(git_repository "git://github.com/jcfr/Gitakest.git") | |
set(src_name "Gitakest-source") | |
set(work_dir ${CMAKE_CURRENT_BINARY_DIR}) | |
set(shell_EXECUTABLE) | |
if(WIN32) | |
get_filename_component(git_EXECUTABLE_EXT ${git_EXECUTABLE} EXT) | |
if(git_EXECUTABLE_EXT STREQUAL ".bat" OR git_EXECUTABLE_EXT STREQUAL ".cmd") | |
find_program(shell_EXECUTABLE | |
NAMES cmd.exe | |
DOC "Command shell" | |
) | |
if (NOT shell_EXECUTABLE) | |
message(FATAL_ERROR "shell_EXECUTABLE not found !") | |
endif() | |
set(shell_EXECUTABLE "${shell_EXECUTABLE} /c") | |
endif() | |
endif() | |
execute_process( | |
COMMAND ${shell_EXECUTABLE} ${git_EXECUTABLE} clone ${git_repository} ${src_name} | |
WORKING_DIRECTORY "${work_dir}" | |
RESULT_VARIABLE error_code | |
) | |
if(error_code) | |
message(FATAL_ERROR "Failed to clone repository: '${git_repository}'") | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment