summaryrefslogtreecommitdiffstats
path: root/Tests/ExternalProject
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-12-04 20:30:37 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-12-04 20:30:37 (GMT)
commit67ebcb9597a06fb151bdc460b9e461b1508b278b (patch)
tree6e6f9737d89cfd48640396c13e17c386be60e980 /Tests/ExternalProject
parent930827d48c39b34e8950cae1a417e53bdbdade0e (diff)
downloadCMake-67ebcb9597a06fb151bdc460b9e461b1508b278b.zip
CMake-67ebcb9597a06fb151bdc460b9e461b1508b278b.tar.gz
CMake-67ebcb9597a06fb151bdc460b9e461b1508b278b.tar.bz2
ENH: Use a TryCheckout technique to decide whether or not to attempt building the projects that depend on a cvs or svn download method.
Diffstat (limited to 'Tests/ExternalProject')
-rw-r--r--Tests/ExternalProject/CMakeLists.txt36
-rw-r--r--Tests/ExternalProject/TryCheckout.cmake54
2 files changed, 84 insertions, 6 deletions
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 086159c..c894037 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -9,6 +9,30 @@ get_external_project_directories(base_dir build_dir downloads_dir install_dir
set(prefix "${install_dir}")
+# Use a "TryCheckout" technique on small subtrees of certain projects
+# to see if cvs checkout and svn checkout may be used on this machine
+# without problems. If so, we can test the projects that use those
+# download techniques. If not, we skip them on this machine...
+#
+include("${CMAKE_CURRENT_SOURCE_DIR}/TryCheckout.cmake")
+
+try_cvs_checkout(
+ ":pserver:anonymous:cmake@www.cmake.org:/cvsroot/CMake"
+ "CMake/Tests/Tutorial/Step1"
+ "${CMAKE_CURRENT_BINARY_DIR}/TryCheckout/TutorialStep1"
+ can_use_cvs
+ )
+
+try_svn_checkout(
+ "http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/gdcmmd5"
+ "${CMAKE_CURRENT_BINARY_DIR}/TryCheckout/gdcmmd5"
+ can_use_svn
+ )
+
+message(STATUS "can_use_cvs='${can_use_cvs}'")
+message(STATUS "can_use_svn='${can_use_svn}'")
+
+
# Local DIR:
#
set(proj TutorialStep5-Local)
@@ -64,7 +88,7 @@ add_external_project(${proj}
# Download CVS:
#
-if(CVS_EXECUTABLE)
+if(can_use_cvs)
# CVS by date stamp:
#
set(proj KWStyle-20081201)
@@ -100,7 +124,7 @@ endif()
# Download SVN:
#
-if(Subversion_SVN_EXECUTABLE)
+if(can_use_svn)
# SVN by date stamp:
#
set(proj gdcm-md5-20081204)
@@ -162,7 +186,7 @@ add_test(TutorialStep1-LocalTGZ-BuildTreeTest
add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest
"${build_dir}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9)
-if(CVS_EXECUTABLE)
+if(can_use_cvs)
add_test(KWStyle-20081201-BuildTreeTest
"${build_dir}/KWStyle-20081201/KWStyle" -xml "${kwstyleXmlFile}" "${header}")
@@ -173,7 +197,7 @@ if(CVS_EXECUTABLE)
"${build_dir}/TutorialStep1-LocalNoDirTGZ/Tutorial" 4)
endif()
-if(Subversion_SVN_EXECUTABLE)
+if(can_use_svn)
add_test(gdcm-md5-20081204-BuildTreeTest
"${build_dir}/gdcm-md5-20081204/md5main" --version)
@@ -190,12 +214,12 @@ endif()
add_test(TutorialStep5-InstallTreeTest
"${install_dir}/bin/Tutorial" 49)
-if(CVS_EXECUTABLE)
+if(can_use_cvs)
add_test(KWStyle-InstallTreeTest
"${install_dir}/bin/KWStyle" -xml "${kwstyleXmlFile}" "${header}")
endif()
-if(Subversion_SVN_EXECUTABLE)
+if(can_use_svn)
add_test(gdcm-md5-InstallTreeTest
"${install_dir}/bin/md5main" --version)
endif()
diff --git a/Tests/ExternalProject/TryCheckout.cmake b/Tests/ExternalProject/TryCheckout.cmake
new file mode 100644
index 0000000..de069eb
--- /dev/null
+++ b/Tests/ExternalProject/TryCheckout.cmake
@@ -0,0 +1,54 @@
+find_package(CVS)
+find_package(Subversion)
+
+
+function(try_cvs_checkout repository module dir result_var)
+ # Assume cvs checkouts will not work:
+ set(${result_var} 0 PARENT_SCOPE)
+
+ if(CVS_EXECUTABLE)
+ message(STATUS "try_cvs_checkout")
+
+ # Ensure directory exists so we can call cvs in it:
+ file(MAKE_DIRECTORY "${dir}")
+
+ # Try to do the cvs checkout command:
+ execute_process(COMMAND ${CVS_EXECUTABLE} -d ${repository} co ${module}
+ WORKING_DIRECTORY ${dir}
+ TIMEOUT 30
+ RESULT_VARIABLE rv)
+
+ # If it worked, cvs checkouts will work:
+ if(rv EQUAL 0)
+ set(${result_var} 1 PARENT_SCOPE)
+ endif()
+
+ message(STATUS "try_cvs_checkout -- done")
+ endif()
+endfunction(try_cvs_checkout)
+
+
+function(try_svn_checkout repository dir result_var)
+ # Assume svn checkouts will not work:
+ set(${result_var} 0 PARENT_SCOPE)
+
+ if(Subversion_SVN_EXECUTABLE)
+ message(STATUS "try_svn_checkout")
+
+ # Ensure directory exists so we can call svn in it:
+ file(MAKE_DIRECTORY "${dir}")
+
+ # Try to do the svn checkout command:
+ execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} co ${repository} ${dir}
+ WORKING_DIRECTORY ${dir}
+ TIMEOUT 30
+ RESULT_VARIABLE rv)
+
+ # If it worked, svn checkouts will work:
+ if(rv EQUAL 0)
+ set(${result_var} 1 PARENT_SCOPE)
+ endif()
+
+ message(STATUS "try_svn_checkout -- done")
+ endif()
+endfunction(try_svn_checkout)