summaryrefslogtreecommitdiffstats
path: root/Tests/ExternalProject
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-06-01 22:18:33 (GMT)
committerDavid Cole <david.cole@kitware.com>2010-06-02 20:28:04 (GMT)
commit670e16af2d76d5a75ed03b895562ac5923fdda56 (patch)
tree07e4f7a262653a9868bc9d7ee9981e818b0b1671 /Tests/ExternalProject
parent7f619608d50cabee8718d78427d560531a3b1ea1 (diff)
downloadCMake-670e16af2d76d5a75ed03b895562ac5923fdda56.zip
CMake-670e16af2d76d5a75ed03b895562ac5923fdda56.tar.gz
CMake-670e16af2d76d5a75ed03b895562ac5923fdda56.tar.bz2
Add git support to ExternalProject.
Requires at least version 1.6.5 of a git client for git submodule update --recursive use.
Diffstat (limited to 'Tests/ExternalProject')
-rw-r--r--Tests/ExternalProject/CMakeLists.txt71
-rw-r--r--Tests/ExternalProject/gitrepo.tgzbin0 -> 1934 bytes
2 files changed, 69 insertions, 2 deletions
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index f02f2f7..09b7619 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -5,6 +5,7 @@ include(ExternalProject)
find_package(CVS)
find_package(Subversion)
+find_program(git_EXECUTABLE NAMES git.cmd git eg.cmd eg DOC "git command line client")
set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(binary_base "${base}/Build")
@@ -37,8 +38,6 @@ if(NOT DEFINED can_build_tutorial_step5)
endif()
endif()
-message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'")
-
# Empty projects that test all the known ExternalProject_Add argument key words:
#
@@ -301,6 +300,67 @@ if(do_svn_tests)
endif()
+set(do_git_tests 0)
+
+if(git_EXECUTABLE)
+ set(do_git_tests 1)
+endif()
+
+
+if(do_git_tests)
+ set(local_git_repo "${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT")
+
+ # Unzip/untar the git repository in our source folder so that other
+ # projects below may use it to test git args of ExternalProject_Add
+ #
+ set(proj SetupLocalGITRepository)
+ ExternalProject_Add(${proj}
+ SOURCE_DIR ${local_git_repo}
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz
+ BUILD_COMMAND ""
+ CONFIGURE_COMMAND ${git_EXECUTABLE} --version
+ INSTALL_COMMAND ""
+ )
+
+ # git by commit id:
+ #
+ set(proj TutorialStep1-GIT-byhash)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_TAG d1970730310fe8bc07e73f15dc570071f9f9654a
+ UPDATE_COMMAND ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+
+ # git by explicit branch/tag name:
+ #
+ set(proj TutorialStep1-GIT-bytag)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_TAG "origin/master"
+ UPDATE_COMMAND ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+
+ # Live git / master (no GIT_TAG):
+ #
+ set(proj TutorialStep1-GIT-master)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+endif()
+
+
# Test the testable built/installed products:
#
enable_testing()
@@ -365,3 +425,10 @@ if(can_build_tutorial_step5)
set_property(TEST TutorialStep5-InstallTreeTest
APPEND PROPERTY LABELS Step5 InstallTree)
endif()
+
+
+message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'")
+message(STATUS "do_cvs_tests='${do_cvs_tests}'")
+message(STATUS "do_svn_tests='${do_svn_tests}'")
+message(STATUS "do_git_tests='${do_git_tests}'")
+message(STATUS "git_EXECUTABLE='${git_EXECUTABLE}'")
diff --git a/Tests/ExternalProject/gitrepo.tgz b/Tests/ExternalProject/gitrepo.tgz
new file mode 100644
index 0000000..0a84bda
--- /dev/null
+++ b/Tests/ExternalProject/gitrepo.tgz
Binary files differ