1 cmake_minimum_required(VERSION 2.6)
2 project(ExternalProjectTest NONE)
4 include(AddExternalProject)
6 get_external_project_directories(base_dir build_dir downloads_dir install_dir
7 sentinels_dir source_dir tmp_dir)
9 set(prefix "${install_dir}")
12 # Use a "TryCheckout" technique on small subtrees of certain projects
13 # to see if cvs checkout and svn checkout may be used on this machine
14 # without problems. If so, we can test the projects that use those
15 # download techniques. If not, we skip them on this machine...
17 include("${CMAKE_CURRENT_SOURCE_DIR}/TryCheckout.cmake")
19 if(NOT DEFINED can_build_kwstyle)
21 set(can_build_kwstyle 0)
23 set(can_build_kwstyle 1)
27 if(NOT DEFINED can_build_tutorial_step5)
28 set(can_build_tutorial_step5 1)
30 # Tutorial Step5 cannot build correctly using Visual Studio 6
31 # on Windows 98 if the path of its build tree exceeds 72
32 # characters in length... So don't attempt to build it
33 # in a long path on Win98:
35 if(CMAKE_SYSTEM STREQUAL "Windows-4.10")
36 string(LENGTH "${build_dir}/TutorialStep5-Local" n)
38 set(can_build_tutorial_step5 0)
43 if(NOT DEFINED can_use_cvs)
45 ":pserver:anonymous:cmake@www.cmake.org:/cvsroot/CMake"
46 "CMake/Tests/Tutorial/Step1"
47 "${CMAKE_CURRENT_BINARY_DIR}/TryCheckout/TutorialStep1"
50 set(can_use_cvs ${can_use_cvs} CACHE STRING "Was try_cvs_checkout successful?")
53 if(NOT DEFINED can_use_svn)
55 "http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/gdcmmd5"
56 "${CMAKE_CURRENT_BINARY_DIR}/TryCheckout/gdcmmd5"
59 set(can_use_svn ${can_use_svn} CACHE STRING "Was try_svn_checkout successful?")
62 message(STATUS "can_build_kwstyle='${can_build_kwstyle}'")
63 message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'")
64 message(STATUS "can_use_cvs='${can_use_cvs}'")
65 message(STATUS "can_use_svn='${can_use_svn}'")
68 # Empty projects that test all the known add_external_project argument key words:
70 set(proj MinimalNoOpProject)
71 add_external_project(${proj}
78 set(proj EmptyNoOpProject)
79 add_external_project(${proj}
88 DEPENDS "MinimalNoOpProject"
106 if(can_build_tutorial_step5)
107 set(proj TutorialStep5-Local)
108 add_external_project(${proj}
109 DIR "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5"
110 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix} -G ${CMAKE_GENERATOR} ${source_dir}/${proj}
117 set(proj TutorialStep1-LocalTAR)
118 add_external_project(${proj}
119 TAR "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar"
121 PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
122 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
123 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
124 -DTEST_LIST:STRING=A::B::C
128 set(proj TutorialStep1-LocalNoDirTAR)
129 add_external_project(${proj}
130 TAR "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar"
132 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix} -G ${CMAKE_GENERATOR} ${source_dir}/${proj}
133 -DTEST_LIST:STRING=1@@2@@3
136 add_external_project_step(${proj} mypatch
137 COMMAND ${CMAKE_COMMAND} -E echo "This is a custom external project step."
138 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
139 WORKING_DIRECTORY ${source_dir}/TutorialStep1-LocalNoDirTAR
147 set(proj TutorialStep1-LocalTGZ)
148 add_external_project(${proj}
149 TGZ "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz"
150 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix} -G ${CMAKE_GENERATOR} ${source_dir}/${proj}
154 set(proj TutorialStep1-LocalNoDirTGZ)
155 add_external_project(${proj}
156 TGZ "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz"
157 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
158 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
165 # TODO: Add a remote .tar file
170 # TODO: Add a remote .tgz file
178 set(proj TutorialStep1-20081201)
179 add_external_project(${proj}
180 CVS_REPOSITORY ":pserver:anonymous:cmake@www.cmake.org:/cvsroot/CMake"
181 CVS_MODULE "CMake/Tests/Tutorial/Step1"
182 CVS_TAG "-D2008-12-01 01:00:00 UTC"
183 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
184 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
190 set(proj kwsys-from-CMake-2-6-2)
191 add_external_project(${proj}
192 CVS_REPOSITORY ":pserver:anonymous:cmake@www.cmake.org:/cvsroot/CMake"
193 CVS_MODULE "CMake/Source/kwsys"
194 CVS_TAG -rCMake-2-6-2
195 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
196 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
200 if(can_build_kwstyle)
201 # Live CVS / HEAD (no CVS_TAG):
203 set(proj KWStyle-CVSHEAD)
204 add_external_project(${proj}
205 CVS_REPOSITORY ":pserver:anoncvs@public.kitware.com:/cvsroot/KWStyle"
207 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
208 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
209 DEPENDS "EmptyNoOpProject"
210 DEPENDS "TutorialStep1-LocalTAR"
211 DEPENDS "TutorialStep1-LocalNoDirTAR"
212 DEPENDS "TutorialStep1-LocalTGZ"
213 DEPENDS "TutorialStep1-LocalNoDirTGZ"
214 DEPENDS "TutorialStep1-20081201"
215 DEPENDS "kwsys-from-CMake-2-6-2"
226 set(proj gdcm-md5-20081204)
227 add_external_project(${proj}
228 SVN_REPOSITORY "http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/gdcmmd5"
229 SVN_TAG "-r{2008-12-04 01:00:00 +0000}"
230 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
231 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
234 # SVN by revision number:
236 set(proj gdcm-md5-r4824)
237 add_external_project(${proj}
238 SVN_REPOSITORY "http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/gdcmmd5"
240 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
241 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
245 # Live SVN / trunk (no SVN_TAG):
247 set(proj gdcm-md5-SVNtrunk)
248 add_external_project(${proj}
249 SVN_REPOSITORY "http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/gdcmmd5"
250 CMAKE_GENERATOR "${CMAKE_GENERATOR}"
251 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${prefix}
257 # Test the testable built/installed products:
262 # Use these as input to the KWStyle tests:
264 set(kwstyleXmlFile "${source_dir}/KWStyle-CVSHEAD/Testing/Data/0001-KWStyleConfiguration.kws.xml")
265 set(header "${install_dir}/include/TutorialConfig.h")
268 # Do at least a smoke test of a built executable from each
269 # project's build directory...
273 if(can_build_tutorial_step5)
274 add_test(TutorialStep5-Local-BuildTreeTest
275 "${build_dir}/TutorialStep5-Local/Tutorial" 42)
278 add_test(TutorialStep1-LocalTAR-BuildTreeTest
279 "${build_dir}/TutorialStep1-LocalTAR/EP-Tutorial" 36)
281 add_test(TutorialStep1-LocalNoDirTAR-BuildTreeTest
282 "${build_dir}/TutorialStep1-LocalNoDirTAR/EP-Tutorial" 25)
284 add_test(TutorialStep1-LocalTGZ-BuildTreeTest
285 "${build_dir}/TutorialStep1-LocalTGZ/Tutorial" 16)
287 add_test(TutorialStep1-LocalNoDirTGZ-BuildTreeTest
288 "${build_dir}/TutorialStep1-LocalNoDirTGZ/Tutorial" 9)
291 add_test(TutorialStep1-20081201-BuildTreeTest
292 "${build_dir}/TutorialStep1-20081201/Tutorial" 4)
294 add_test(kwsys-from-CMake-2-6-2-BuildTreeTest
295 "${build_dir}/kwsys-from-CMake-2-6-2/kwsysTestProcess" 1)
297 if(can_build_kwstyle)
298 add_test(KWStyle-CVSHEAD-BuildTreeTest
299 "${build_dir}/KWStyle-CVSHEAD/KWStyle" -xml "${kwstyleXmlFile}" "${header}")
304 add_test(gdcm-md5-20081204-BuildTreeTest
305 "${build_dir}/gdcm-md5-20081204/md5main" --version)
307 add_test(gdcm-md5-r4824-BuildTreeTest
308 "${build_dir}/gdcm-md5-r4824/md5main" --version)
310 add_test(gdcm-md5-SVNtrunk-BuildTreeTest
311 "${build_dir}/gdcm-md5-SVNtrunk/md5main" --version)
317 if(can_build_tutorial_step5)
318 add_test(TutorialStep5-InstallTreeTest
319 "${install_dir}/bin/Tutorial" 49)
323 if(can_build_kwstyle)
324 add_test(KWStyle-InstallTreeTest
325 "${install_dir}/bin/KWStyle" -xml "${kwstyleXmlFile}" "${header}")
330 add_test(gdcm-md5-InstallTreeTest
331 "${install_dir}/bin/md5main" --version)