diff options
author | Brad King <brad.king@kitware.com> | 2010-06-07 18:23:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-07 18:23:45 (GMT) |
commit | a03e85f13c1e1e649eae7db62c500b7ec0b692ae (patch) | |
tree | c38d2b27d92068e44905e5919a0efae1ac773864 /Tests | |
parent | 79f01660c922db5683a65c4c1efbc767dc817b6b (diff) | |
parent | 29383b4b85fc0f728a166a9d4e8abf123f862212 (diff) | |
download | CMake-a03e85f13c1e1e649eae7db62c500b7ec0b692ae.zip CMake-a03e85f13c1e1e649eae7db62c500b7ec0b692ae.tar.gz CMake-a03e85f13c1e1e649eae7db62c500b7ec0b692ae.tar.bz2 |
Merge branch 'add-git-to-ExternalProject'
Conflicts:
Modules/ExternalProject.cmake
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ExternalProject/CMakeLists.txt | 88 | ||||
-rw-r--r-- | Tests/ExternalProject/gitrepo.tgz | bin | 0 -> 1934 bytes |
2 files changed, 84 insertions, 4 deletions
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 123dcb4..2f1f49d 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -5,6 +5,7 @@ include(ExternalProject) find_package(CVS) find_package(Subversion) +find_package(Git) 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: # @@ -212,7 +211,7 @@ if(do_cvs_tests) SOURCE_DIR ${local_cvs_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/cvsrepo.tgz BUILD_COMMAND "" - CONFIGURE_COMMAND ${CVS_EXECUTABLE} --version + CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version INSTALL_COMMAND "" ) @@ -310,7 +309,7 @@ if(do_svn_tests) SOURCE_DIR ${local_svn_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/svnrepo.tgz BUILD_COMMAND "" - CONFIGURE_COMMAND ${Subversion_SVN_EXECUTABLE} --version + CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version INSTALL_COMMAND "" ) @@ -353,6 +352,80 @@ if(do_svn_tests) endif() +set(do_git_tests 0) + +if(GIT_EXECUTABLE) + set(do_git_tests 1) + + execute_process( + COMMAND "${GIT_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}") + message(STATUS "git_version='${git_version}'") + + if(git_version VERSION_LESS 1.6.5) + message(STATUS "No ExternalProject git tests with git client less than version 1.6.5") + set(do_git_tests 0) + endif() +endif() + + +if(do_git_tests) + set(local_git_repo "../../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 ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT + 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() @@ -417,3 +490,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 Binary files differnew file mode 100644 index 0000000..0a84bda --- /dev/null +++ b/Tests/ExternalProject/gitrepo.tgz |