Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / CMakeLists.txt
blob4a4229a8da0dae53de4f98bc0dc90aa870a474bd
1 # a macro for tests that have a simple format where the name matches the
2 # directory and project
3 MACRO(ADD_TEST_MACRO NAME COMMAND)
4   ADD_TEST(${NAME} ${CMAKE_CTEST_COMMAND}
5     --build-and-test
6     "${CMake_SOURCE_DIR}/Tests/${NAME}"
7     "${CMake_BINARY_DIR}/Tests/${NAME}"
8     --build-two-config
9     --build-generator ${CMAKE_TEST_GENERATOR}
10     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
11     --build-project ${NAME}
12     --test-command ${COMMAND})
13   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${NAME}")
14 ENDMACRO(ADD_TEST_MACRO)
16 # Make sure the 'testing' test gets a proper configuration.
17 CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
18                ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
19 SET_DIRECTORY_PROPERTIES(PROPERTIES
20   TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake"
21   )
23 # Testing
24 IF(BUILD_TESTING)
25   # Collect a list of all test build directories.
26   SET(TEST_BUILD_DIRS)
28   # Should the long tests be run?
29   OPTION(CMAKE_RUN_LONG_TESTS 
30     "Should the long tests be run (such as Bootstrap)." ON)
31   MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS)
33   IF (CMAKE_RUN_LONG_TESTS)
34     OPTION(CTEST_TEST_CTEST 
35       "Should the tests that run a full sub ctest process be run?" 
36       OFF)
37     MARK_AS_ADVANCED(CTEST_TEST_CTEST)
38   ENDIF (CMAKE_RUN_LONG_TESTS)
40   # Should CPack tests be run? By default, yes, but...
41   #
42   # Disable packaging test on Apple 10.3 and below. PackageMaker starts
43   # DiskManagementTool as root and disowns it
44   # (http://lists.apple.com/archives/installer-dev/2005/Jul/msg00005.html).
45   # It is left holding open pipe handles and preventing ProcessUNIX from
46   # detecting end-of-data even after its immediate child exits. Then
47   # the test hangs until it times out and is killed. This is a
48   # well-known bug in kwsys process execution that I would love to get
49   # time to fix.
50   #
51   OPTION(CTEST_TEST_CPACK
52     "Should the tests that use '--build-target package' be run?"
53     ON)
54   MARK_AS_ADVANCED(CTEST_TEST_CPACK)
55   IF(APPLE AND CTEST_TEST_CPACK)
56     EXECUTE_PROCESS(
57       COMMAND sw_vers -productVersion
58       OUTPUT_VARIABLE OSX_VERSION
59       OUTPUT_STRIP_TRAILING_WHITESPACE
60       )
61     IF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
62       MESSAGE(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4")
63       MESSAGE(STATUS "OSX_VERSION='${OSX_VERSION}'")
64       SET(CTEST_TEST_CPACK OFF)
65     ENDIF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
66   ENDIF(APPLE AND CTEST_TEST_CPACK)
68   # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
69   # whichever is greater.
70   SET(CMAKE_LONG_TEST_TIMEOUT 1500)
71   IF(CTEST_TEST_TIMEOUT)
72     SET(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT})
73   ENDIF(CTEST_TEST_TIMEOUT)
74   IF(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
75     SET(CMAKE_LONG_TEST_TIMEOUT 1500)
76   ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
78   # add a bunch of standard build-and-test style tests
79   ADD_TEST_MACRO(CommandLineTest CommandLineTest)
80   ADD_TEST_MACRO(FindPackageTest FindPackageTest)
81   ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
82   ADD_TEST_MACRO(StringFileTest StringFileTest)
83   ADD_TEST_MACRO(TryCompile TryCompile)
84   ADD_TEST_MACRO(TarTest TarTest)
85   ADD_TEST_MACRO(SystemInformation SystemInformation)
86   ADD_TEST_MACRO(MathTest MathTest)
87   ADD_TEST_MACRO(Simple Simple)
88   ADD_TEST_MACRO(PreOrder PreOrder)
89   ADD_TEST_MACRO(COnly COnly)
90   ADD_TEST_MACRO(CxxOnly CxxOnly)
91   ADD_TEST_MACRO(NewlineArgs NewlineArgs)
92   ADD_TEST_MACRO(SetLang SetLang)
93   ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
94   ADD_TEST_MACRO(LoadCommand LoadedCommand)
95   ADD_TEST_MACRO(LinkLine LinkLine)
96   ADD_TEST_MACRO(MacroTest miniMacroTest)
97   ADD_TEST_MACRO(FunctionTest miniFunctionTest)
98   ADD_TEST_MACRO(ReturnTest ReturnTest)
99   ADD_TEST_MACRO(Properties Properties)
100   ADD_TEST_MACRO(Assembler HelloAsm)
101   ADD_TEST_MACRO(SourceGroups SourceGroups)
102   ADD_TEST_MACRO(Preprocess Preprocess)
103   ADD_TEST_MACRO(ExportImport ExportImport)
104   ADD_TEST_MACRO(Unset Unset)
105   ADD_TEST_MACRO(PolicyScope PolicyScope)
107   SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
108   SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
109   CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
110     "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY)
111   ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P
112     "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake")
114   # If we are running right now with a UnixMakefiles based generator,
115   # build the "Simple" test with the ExtraGenerators, if available
116   # This doesn't test whether the generated project files work (unfortunately), 
117   # mainly it tests that cmake doesn't crash when generating these project files.
118   IF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles"  OR  ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
119     # check which generators we have
120     EXEC_PROGRAM(${CMAKE_CMAKE_COMMAND} ARGS --help OUTPUT_VARIABLE cmakeOutput )
121     # check for the Eclipse generator
122     IF ("${cmakeOutput}" MATCHES Eclipse)
123       ADD_TEST(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
124          --build-and-test
125          "${CMake_SOURCE_DIR}/Tests/Simple"
126          "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator"
127          --build-two-config
128          --build-generator "Eclipse CDT4 - Unix Makefiles"
129          --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
130          --build-project Simple
131          --test-command Simple)
132       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator")
133     ENDIF ("${cmakeOutput}" MATCHES Eclipse)
135     # check for the CodeBlocks generator
136     IF ("${cmakeOutput}" MATCHES CodeBlocks)
137       ADD_TEST(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND}
138          --build-and-test
139          "${CMake_SOURCE_DIR}/Tests/Simple"
140          "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator"
141          --build-two-config
142          --build-generator "CodeBlocks - Unix Makefiles"
143          --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
144          --build-project Simple
145          --test-command Simple)
146       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
147     ENDIF ("${cmakeOutput}" MATCHES CodeBlocks)
149     # check for the KDevelop3 generator
150     IF ("${cmakeOutput}" MATCHES KDevelop3)
151       ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}
152          --build-and-test
153          "${CMake_SOURCE_DIR}/Tests/Simple"
154          "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator"
155          --build-two-config
156          --build-generator "KDevelop3 - Unix Makefiles"
157          --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
158          --build-project Simple
159          --test-command Simple)
160       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator")
161     ENDIF ("${cmakeOutput}" MATCHES KDevelop3)
163   ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles"  OR  ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
165   # test for correct sub-project generation
166   # not implemented in VS6 or Xcode
167   IF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70)
168     # run cmake and configure all of SubProject
169     # but only build the independent executable car
170     ADD_TEST(SubProject ${CMAKE_CTEST_COMMAND}
171       --build-and-test
172       "${CMake_SOURCE_DIR}/Tests/SubProject"
173       "${CMake_BINARY_DIR}/Tests/SubProject"
174       --build-project SubProject
175       --build-generator ${CMAKE_TEST_GENERATOR}
176       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
177       --build-target car
178       --test-command car
179       )
180     # For stage 2, do not run cmake again.
181     # Then build the foo sub project which should build
182     # the bar library which should be referenced because
183     # foo links to the static library bar, but bar is not
184     # directly in the foo sub project
185     ADD_TEST(SubProject-Stage2  ${CMAKE_CTEST_COMMAND}
186       --build-and-test
187       "${CMake_SOURCE_DIR}/Tests/SubProject/foo"
188       "${CMake_BINARY_DIR}/Tests/SubProject/foo" 
189       --build-generator ${CMAKE_TEST_GENERATOR}
190       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
191       --build-nocmake 
192       --build-project foo
193       --build-target foo
194       --test-command foo
195       )
196     SET_TESTS_PROPERTIES ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
197     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
198   ENDIF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70)
200   IF (CMAKE_STRICT)
201     ADD_TEST_MACRO(DocTest DocTest)
202   ENDIF (CMAKE_STRICT)
203     
204   IF(CMAKE_BUILD_NIGHTLY_WINDOWS_TEST)
205     FILE(MAKE_DIRECTORY "${CMake_BINARY_DIR}/Tests/CMake-CVS")
206     FILE(WRITE "${CMake_BINARY_DIR}/Tests/CMake-CVS/nightly-cmake.sh"
207 "cd ${CMake_BINARY_DIR}/Tests/CMake-CVS
208 ${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Release/vogon_release.cmake
209 ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
211     ADD_TEST(NightlyCMakeBuild 
212       /bin/sh ${CMake_BINARY_DIR}/Tests/CMake-CVS/nightly-cmake.sh)
213     SET_TESTS_PROPERTIES ( NightlyCMakeBuild PROPERTIES TIMEOUT 3500)
214   ENDIF(CMAKE_BUILD_NIGHTLY_WINDOWS_TEST)
217   # add tests with more complex invocations
218   ADD_TEST(Framework ${CMAKE_CTEST_COMMAND}
219     --build-and-test
220     "${CMake_SOURCE_DIR}/Tests/Framework"
221     "${CMake_BINARY_DIR}/Tests/Framework"
222     --build-two-config
223     --build-generator ${CMAKE_TEST_GENERATOR}
224     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
225     --build-project Framework
226     --build-options
227     "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
228     --test-command bar)
229   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
231   ADD_TEST(TargetName ${CMAKE_CTEST_COMMAND}
232     --build-and-test
233     "${CMake_SOURCE_DIR}/Tests/TargetName"
234     "${CMake_BINARY_DIR}/Tests/TargetName"
235     --build-two-config
236     --build-generator ${CMAKE_TEST_GENERATOR}
237     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
238     --build-project TargetName
239     --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files 
240     ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
241     ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
242   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName")
244   ADD_TEST(LibName ${CMAKE_CTEST_COMMAND}
245     --build-and-test
246     "${CMake_SOURCE_DIR}/Tests/LibName"
247     "${CMake_BINARY_DIR}/Tests/LibName"
248     --build-two-config
249     --build-generator ${CMAKE_TEST_GENERATOR}
250     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
251     --build-project LibName 
252     --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
253     --test-command foobar
254     )
255   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")
257   ADD_TEST(CustComDepend ${CMAKE_CTEST_COMMAND}
258     --build-and-test
259     "${CMake_SOURCE_DIR}/Tests/CustComDepend"
260     "${CMake_BINARY_DIR}/Tests/CustComDepend"
261     --build-two-config
262     --build-generator ${CMAKE_TEST_GENERATOR}
263     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
264     --build-project CustComDepend 
265     --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
266     --test-command foo bar.c
267     )
268   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend")
270   ADD_TEST(CustomCommand  ${CMAKE_CTEST_COMMAND}
271     --build-and-test
272     "${CMake_SOURCE_DIR}/Tests/CustomCommand"
273     "${CMake_BINARY_DIR}/Tests/CustomCommand"
274     --build-two-config
275     --build-generator ${CMAKE_TEST_GENERATOR}
276     --build-project CustomCommand
277     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
278     --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
279     --test-command CustomCommand
280     )
281   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
283   ADD_TEST(CustomCommandWorkingDirectory  ${CMAKE_CTEST_COMMAND}
284     --build-and-test
285     "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory"
286     "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory"
287     --build-two-config
288     --build-generator ${CMAKE_TEST_GENERATOR}
289     --build-project TestWorkingDir
290     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
291     --test-command working
292     )
293   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory")
295    #ADD_TEST(SimpleExclude ${CMAKE_CTEST_COMMAND}
296    #  --build-and-test
297    #  "${CMake_SOURCE_DIR}/Tests/SimpleExclude"
298    #  "${CMake_BINARY_DIR}/Tests/SimpleExclude"
299    #  --build-generator ${CMAKE_TEST_GENERATOR}
300    #  --build-project SimpleExclude
301    #  --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
302    #  --build-two-config
303    #  --test-command t4
304    #--test-command "${CMAKE_COMMAND}"
305    #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
306    #-P "${CMAKE_BINARY_DIR}/Tests/SimpleExclude/run.cmake"
307    #)
309 #  ADD_TEST(SameName  ${CMAKE_CTEST_COMMAND}
310 #    --build-and-test
311 #    "${CMake_SOURCE_DIR}/Tests/SameName"
312 #    "${CMake_BINARY_DIR}/Tests/SameName"
313 #    --build-generator ${CMAKE_TEST_GENERATOR}
314 #    --build-project SameName
315 #    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
316 #    --build-two-config
317 #    --test-command
318 #    "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2")
320   ADD_TEST(OutOfSource ${CMAKE_CTEST_COMMAND}
321     --build-and-test
322     "${CMake_SOURCE_DIR}/Tests/OutOfSource"
323     "${CMake_BINARY_DIR}/Tests/OutOfSource"
324     --build-generator ${CMAKE_TEST_GENERATOR}
325     --build-project OutOfSource
326     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
327     --build-two-config
328     --test-command
329     "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
330   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource")
331   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep")
332   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary")
334   ADD_TEST(BuildDepends ${CMAKE_CTEST_COMMAND}
335     --build-and-test
336     "${CMake_SOURCE_DIR}/Tests/BuildDepends"
337     "${CMake_BINARY_DIR}/Tests/BuildDepends"
338     --build-generator ${CMAKE_TEST_GENERATOR}
339     --build-project BuildDepends
340     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
341     )
342   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
343   
344   SET(SimpleInstallInstallDir
345     "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
346   ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
347     --build-and-test
348     "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
349     "${CMake_BINARY_DIR}/Tests/SimpleInstall"
350     --build-generator ${CMAKE_TEST_GENERATOR}
351     --build-project TestSimpleInstall
352     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
353     --build-two-config
354     --build-options
355     "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
356     --test-command   ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
357   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
358   ADD_TEST(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
359     --build-and-test
360     "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
361     "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
362     --build-generator ${CMAKE_TEST_GENERATOR}
363     --build-project TestSimpleInstall
364     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
365     --build-two-config
366     --build-options
367     "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
368     "-DSTAGE2:BOOL=1"
369     --test-command   ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
370   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
372   # By default, run the CPackComponents test if the CTEST_TEST_CPACK
373   # option is ON:
374   #
375   set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
376   set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
378   # But on Windows, only run the CPackComponents test if the NSIS
379   # installer builder is available:
380   #
381   if(WIN32)
382     find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
383       PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
384       DOC "makensis.exe location"
385       )
386     if(NSIS_MAKENSIS_EXECUTABLE)
387       set(CTEST_RUN_CPackComponents ON)
388     else(NSIS_MAKENSIS_EXECUTABLE)
389       set(CTEST_RUN_CPackComponents OFF)
390       set(CTEST_package_X11_TEST OFF)
391     endif(NSIS_MAKENSIS_EXECUTABLE)
392   endif(WIN32)
394   IF(CTEST_RUN_CPackComponents)
395     set(CPackComponents_EXTRA_OPTIONS)
396     if(APPLE)
397       set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
398     endif(APPLE)
400     ADD_TEST(CPackComponents ${CMAKE_CTEST_COMMAND}
401       --build-and-test
402       "${CMake_SOURCE_DIR}/Tests/CPackComponents"
403       "${CMake_BINARY_DIR}/Tests/CPackComponents"
404       --build-generator ${CMAKE_TEST_GENERATOR}
405       --build-project CPackComponents
406       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
407       --build-two-config
408       --build-target package
409       --build-options
410         -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
411         -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
412         ${CPackComponents_EXTRA_OPTIONS}
413       --test-command ${CMAKE_CMAKE_COMMAND}
414         "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
415         -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
416     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
417   ENDIF(CTEST_RUN_CPackComponents)
419   IF(CTEST_package_X11_TEST)
420     SET(X11_build_target_arg --build-target package)
421   ELSE(CTEST_package_X11_TEST)
422     SET(X11_build_target_arg)
423   ENDIF(CTEST_package_X11_TEST)
425   ADD_TEST(X11 ${CMAKE_CTEST_COMMAND}
426     --build-and-test
427     "${CMake_SOURCE_DIR}/Tests/X11"
428     "${CMake_BINARY_DIR}/Tests/X11"
429     --build-generator ${CMAKE_TEST_GENERATOR}
430     --build-project UseX11
431     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
432     --build-two-config
433     ${X11_build_target_arg}
434     --test-command  UseX11)
435   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11")
437   ADD_TEST(LoadedCommandOneConfig  ${CMAKE_CTEST_COMMAND}
438     --build-and-test
439     "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
440     "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
441     --build-generator ${CMAKE_TEST_GENERATOR}
442     --build-project LoadCommand
443     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
444     --test-command  LoadedCommand
445     )
446   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
448   # Como does not seem to support shared libraries.
449   GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
450   IF(CMAKE_BASE_NAME MATCHES "^como$")
451     SET(COMPILER_IS_COMO 1)
452   ENDIF(CMAKE_BASE_NAME MATCHES "^como$")
453   IF(NOT COMPILER_IS_COMO)
454     ADD_TEST(complex  ${CMAKE_CTEST_COMMAND}
455       --build-and-test
456       "${CMake_SOURCE_DIR}/Tests/Complex"
457       "${CMake_BINARY_DIR}/Tests/Complex"
458       --build-two-config
459       --build-config-sample "${CMAKE_CTEST_COMMAND}"
460       --build-generator ${CMAKE_TEST_GENERATOR}
461       --build-project Complex
462       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
463       --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
464       --build-options
465       -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR}
466       -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES}
467       --test-command complex
468       )
469     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex")
471     ADD_TEST(complexOneConfig  ${CMAKE_CTEST_COMMAND}
472       --build-and-test
473       "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
474       "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
475       --build-generator ${CMAKE_TEST_GENERATOR}
476       --build-project Complex
477       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
478       --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
479       --build-options
480       -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR}
481       -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES}
482       --test-command complex)
483     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
485 # This fails on VS 70
486 # works on Xcode and makefiles
487 #      ADD_TEST(ConvLibrary ${CMAKE_CTEST_COMMAND}
488 #        --build-and-test
489 #        "${CMake_SOURCE_DIR}/Tests/ConvLibrary"
490 #        "${CMake_BINARY_DIR}/Tests/ConvLibrary"
491 #        --build-two-config
492 #        --build-generator ${CMAKE_TEST_GENERATOR}
493 #        --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
494 #        --build-project ConvLibrary
495 #        --test-command bartest)
498 #    ADD_TEST(complexRelativePaths  ${CMAKE_CTEST_COMMAND}
499 #      --build-and-test
500 #      "${CMake_SOURCE_DIR}/Tests/ComplexRelativePaths"
501 #      "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths"
502 #      --build-generator ${CMAKE_TEST_GENERATOR}
503 #      --build-project complex
504 #      --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
505 #      --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths/bin"
506 #      --build-options -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON
507 #      --test-command complex)
509   ENDIF(NOT COMPILER_IS_COMO)
511   ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
512     --build-and-test
513     "${CMake_SOURCE_DIR}/Example"
514     "${CMake_BINARY_DIR}/Example"
515     --build-generator ${CMAKE_TEST_GENERATOR}
516     --build-project HELLO
517     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
518     --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo"
519     --test-command helloDemo
520     )
521   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example")
523   ADD_TEST(Environment ${CMAKE_CTEST_COMMAND}
524     --build-and-test
525     "${CMake_SOURCE_DIR}/Tests/Environment"
526     "${CMake_BINARY_DIR}/Tests/Environment"
527     --build-generator ${CMAKE_TEST_GENERATOR}
528     --build-project EnvironmentProj
529     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
530     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment"
531     --force-new-ctest-process
532     --test-command ${CMAKE_CTEST_COMMAND} -V
533     )
534   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
536   ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND}
537     --build-and-test
538     "${CMake_SOURCE_DIR}/Tests/ExternalProject"
539     "${CMake_BINARY_DIR}/Tests/ExternalProject"
540     --build-generator ${CMAKE_TEST_GENERATOR}
541     --build-project ExternalProjectTest
542     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
543     --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject"
544     --force-new-ctest-process
545     --test-command ${CMAKE_CTEST_COMMAND} -V
546     )
547   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
549   # do each of the tutorial steps
550   FOREACH(STP RANGE 1 7)
551     ADD_TEST(TutorialStep${STP} ${CMAKE_CTEST_COMMAND}
552       --build-and-test
553       "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}"
554       "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}"
555       --build-two-config
556       --build-generator ${CMAKE_TEST_GENERATOR}
557       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
558       --build-project Tutorial
559       --test-command Tutorial 25.0)
560   ENDFOREACH(STP)
561   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial")
563   ADD_TEST(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
564     --build-and-test
565     "${CMake_SOURCE_DIR}/Tests/Testing"
566     "${CMake_BINARY_DIR}/Tests/Testing"
567     --build-generator ${CMAKE_TEST_GENERATOR}
568     --build-project Testing
569     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
570     --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
571     )
572   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing")
574   ADD_TEST(wrapping  ${CMAKE_CTEST_COMMAND}
575     --build-and-test
576     "${CMake_SOURCE_DIR}/Tests/Wrapping"
577     "${CMake_BINARY_DIR}/Tests/Wrapping"
578     --build-generator ${CMAKE_TEST_GENERATOR}
579     --build-project Wrapping
580     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
581     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
582     --test-command wrapping
583     )
584   ADD_TEST(qtwrapping  ${CMAKE_CTEST_COMMAND}
585     --build-and-test
586     "${CMake_SOURCE_DIR}/Tests/Wrapping"
587     "${CMake_BINARY_DIR}/Tests/Wrapping"
588     --build-generator ${CMAKE_TEST_GENERATOR}
589     --build-project Wrapping
590     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
591     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
592       --test-command qtwrapping
593       )
594   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping")
596   ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND}
597     --build-and-test
598     "${CMake_SOURCE_DIR}/Tests/TestDriver"
599     "${CMake_BINARY_DIR}/Tests/TestDriver"
600     --build-generator ${CMAKE_TEST_GENERATOR}
601     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
602     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
603     --build-project TestDriverTest
604     --test-command TestDriverTest test1
605     )
607   ADD_TEST(testdriver2 ${CMAKE_CTEST_COMMAND}
608     --build-and-test
609     "${CMake_SOURCE_DIR}/Tests/TestDriver"
610     "${CMake_BINARY_DIR}/Tests/TestDriver"
611     --build-generator ${CMAKE_TEST_GENERATOR}
612     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
613     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
614     --build-project TestDriverTest
615     --test-command TestDriverTest test2
616     )
618   ADD_TEST(testdriver3  ${CMAKE_CTEST_COMMAND}
619     --build-and-test
620     "${CMake_SOURCE_DIR}/Tests/TestDriver"
621     "${CMake_BINARY_DIR}/Tests/TestDriver"
622     --build-generator ${CMAKE_TEST_GENERATOR}
623     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
624     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
625     --build-project TestDriverTest
626     --test-command TestDriverTest subdir/test3
627     )
628   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver")
630   ADD_TEST(Dependency ${CMAKE_CTEST_COMMAND}
631     --build-and-test
632     "${CMake_SOURCE_DIR}/Tests/Dependency"
633     "${CMake_BINARY_DIR}/Tests/Dependency"
634     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
635     --build-generator ${CMAKE_TEST_GENERATOR}
636     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
637     --build-project Dependency
638     --test-command exec
639     )
640   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency")
642   IF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
644 # RPATH isn't supported under Syllable, so the tests don't
645 # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR
646 # in the tests would have to be adjusted to ${EXECUTABLE_OUTPUT_DIR}/lib .
647 # For now we just require on Syllable that the user adjusts the DLL_PATH 
648 # environment variable, so except the two tests below all other tests will succeed.
650     SET(_DLL_PATH "$ENV{DLL_PATH}")
651     IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$")
652       MESSAGE(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/.\" to the DLL_PATH environment variable")
653     ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$")
654     IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$")
655       MESSAGE(FATAL_ERROR "In order to successfully run the CMake test suite on Syllable you need to add \"\\@bindir\\@/../lib\" to the DLL_PATH environment variable")
656     ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$")
658   ELSE("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
660     ADD_TEST(JumpWithLibOut  ${CMAKE_CTEST_COMMAND}
661       --build-and-test
662       "${CMake_SOURCE_DIR}/Tests/Jump"
663       "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut"
664       --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable"
665       --build-project Jump
666       --build-generator ${CMAKE_TEST_GENERATOR}
667       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
668       --build-options
669       -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib
670       --test-command jumpExecutable
671       )
673     ADD_TEST(JumpNoLibOut  ${CMAKE_CTEST_COMMAND}
674       --build-and-test
675       "${CMake_SOURCE_DIR}/Tests/Jump"
676       "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut"
677       --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
678       --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
679       --build-project Jump
680       --build-generator ${CMAKE_TEST_GENERATOR}
681       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
682       --test-command jumpExecutable
683       )
684     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump")
686     ADD_TEST(Plugin ${CMAKE_CTEST_COMMAND}
687       --build-and-test
688       "${CMake_SOURCE_DIR}/Tests/Plugin"
689       "${CMake_BINARY_DIR}/Tests/Plugin"
690       --build-generator ${CMAKE_TEST_GENERATOR}
691       --build-project Plugin
692       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
693       --build-two-config
694       --test-command bin/example)
695     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin")
697     IF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
698       ADD_TEST_MACRO(RuntimePath RuntimePath)
699     ENDIF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
700   ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
702   ADD_TEST(linkorder1 ${CMAKE_CTEST_COMMAND}
703     --build-and-test
704     "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
705     "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
706     --build-generator ${CMAKE_TEST_GENERATOR}
707     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
708     --build-project LinkLineOrder
709     --test-command Exec1
710     )
712   ADD_TEST(linkorder2  ${CMAKE_CTEST_COMMAND}
713     --build-and-test
714     "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
715     "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
716     --build-generator ${CMAKE_TEST_GENERATOR}
717     --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
718     --build-project LinkLineOrder
719     --test-command Exec2
720     )
721   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
722   SET_TESTS_PROPERTIES ( qtwrapping PROPERTIES DEPENDS wrapping)
723   SET_TESTS_PROPERTIES ( testdriver1 PROPERTIES DEPENDS qtwrapping)
724   SET_TESTS_PROPERTIES ( testdriver2 PROPERTIES DEPENDS testdriver1)
725   SET_TESTS_PROPERTIES ( testdriver3 PROPERTIES DEPENDS testdriver2)
726   SET_TESTS_PROPERTIES ( linkorder2 PROPERTIES DEPENDS linkorder1)
727   SET_TESTS_PROPERTIES ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall)
729   IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
730     ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND}
731       --build-and-test
732       "${CMake_SOURCE_DIR}/Source/kwsys"
733       "${CMake_BINARY_DIR}/Tests/kwsys"
734       --build-generator ${CMAKE_TEST_GENERATOR}
735       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
736       --build-project kwsys
737       --test-command kwsysTestsCxx testIOS
738       )
739     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
740   ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
741   SET(MAKE_IS_GNU )
742   IF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
743     EXEC_PROGRAM(
744       ${CMAKE_TEST_MAKEPROGRAM} ARGS no_such_target --version
745       RETURN_VALUE res OUTPUT_VARIABLE out
746       )
747     IF("${res}" EQUAL 0)
748       IF("${out}" MATCHES "GNU")
749         SET(MAKE_IS_GNU 1)
750       ENDIF("${out}" MATCHES "GNU")
751     ENDIF("${res}" EQUAL 0)
752   ENDIF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
754   # only add this test on platforms that support it
755   # some old versions of make simply cannot handle spaces in paths
756   IF (MAKE_IS_GNU OR 
757       "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
758       "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
759     ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND}
760       --build-and-test
761       "${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
762       "${CMake_BINARY_DIR}/Tests/SubDirSpaces"
763       --build-exe-dir 
764       "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources"
765       --build-generator ${CMAKE_TEST_GENERATOR}
766       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
767       --build-project SUBDIR
768       --test-command test
769       "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere"
770       "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
771       )
772     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces")
773   ENDIF (MAKE_IS_GNU OR
774     "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
775     "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
777   IF (WIN32)
778     ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
779       --build-and-test
780       "${CMake_SOURCE_DIR}/Tests/SubDir"
781       "${CMake_BINARY_DIR}/Tests/SubDir"
782       --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
783       --build-generator ${CMAKE_TEST_GENERATOR}
784       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
785       --build-project SUBDIR
786       --test-command test
787       "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
788       "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
789       )
790   ELSE (WIN32)
791     ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
792       --build-and-test
793       "${CMake_SOURCE_DIR}/Tests/SubDir"
794       "${CMake_BINARY_DIR}/Tests/SubDir"
795       --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
796       --build-generator ${CMAKE_TEST_GENERATOR}
797       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
798       --build-project SUBDIR
799       --test-command test
800       "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
801       "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
802       )
803   ENDIF (WIN32)
804   LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
806   IF(CMAKE_TEST_MSVC)
807     ADD_TEST_MACRO(PrecompiledHeader foo)
808   ENDIF(CMAKE_TEST_MSVC)
810   IF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
811     ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND}
812       --build-and-test
813       "${CMake_SOURCE_DIR}/Tests/MakeClean"
814       "${CMake_BINARY_DIR}/Tests/MakeClean"
815       --build-generator ${CMAKE_TEST_GENERATOR}
816       --build-project MakeClean
817       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
818       --build-exe-dir "${CMake_BINARY_DIR}/MakeClean"
819       --test-command check_clean
820       )
821     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
822   ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
824   IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
825     ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND}
826       --build-and-test
827       "${CMake_SOURCE_DIR}/Tests/VSExternalInclude"
828       "${CMake_BINARY_DIR}/Tests/VSExternalInclude"
829       --build-two-config
830       --build-generator ${CMAKE_TEST_GENERATOR}
831       --build-project VSExternalInclude
832       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
833       --test-command VSExternalInclude)
834     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude")
835   ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
837   IF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
838     SET(BundleTestInstallDir
839       "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory")
840     ADD_TEST(BundleTest ${CMAKE_CTEST_COMMAND}
841       --build-and-test
842       "${CMake_SOURCE_DIR}/Tests/BundleTest"
843       "${CMake_BINARY_DIR}/Tests/BundleTest"
844       --build-two-config
845       --build-generator ${CMAKE_TEST_GENERATOR}
846       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
847       --build-project BundleTest
848       --build-target install
849 #     --build-target package
850       --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}"
851        "-DCMake_SOURCE_DIR:PATH=${CMAKE_SOURCE_DIR}"
852       --test-command
853       ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe)
854     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest")
856     ADD_TEST_MACRO(ObjC++ ObjC++)
857   ENDIF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
859   IF(APPLE AND CTEST_TEST_CPACK)
860     ADD_TEST(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
861       --build-and-test
862       "${CMake_SOURCE_DIR}/Tests/BundleGeneratorTest"
863       "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest"
864       --build-two-config
865       --build-generator ${CMAKE_TEST_GENERATOR}
866       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} 
867       --build-project BundleGeneratorTest
868       --build-target package
869       --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
870       )
871     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
872   ENDIF(APPLE AND CTEST_TEST_CPACK)
874   SET(CTEST_TEST_UPDATE 1)
875   IF(CTEST_TEST_UPDATE)
876     # Test CTest Update with Subversion
877     FIND_PACKAGE(Subversion QUIET)
878     IF(Subversion_FOUND)
879       GET_FILENAME_COMPONENT(_Subversion_BIN_DIR
880         ${Subversion_SVN_EXECUTABLE} PATH)
881       FIND_PROGRAM(Subversion_SVNADMIN_EXECUTABLE svnadmin
882         HINTS ${_Subversion_BIN_DIR}
883         )
884       MARK_AS_ADVANCED(Subversion_SVNADMIN_EXECUTABLE)
885       IF(NOT Subversion_SVNADMIN_EXECUTABLE)
886         SET(Subversion_FOUND FALSE)
887       ENDIF(NOT Subversion_SVNADMIN_EXECUTABLE)
888     ENDIF(Subversion_FOUND)
889     IF(Subversion_FOUND)
890       SET(CTestUpdateSVN_DIR "CTest UpdateSVN")
891       CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in"
892         "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY)
893       ADD_TEST(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND}
894         -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake"
895         )
896       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}")
897     ENDIF(Subversion_FOUND)
899     # Test CTest Update with CVS
900     IF(UNIX)
901       # The test is expected to work by default on UNIX-like systems.
902       SET(CTEST_TEST_UPDATE_CVS 1)
903     ELSE(UNIX)
904       # Special CVS configuration is needed for test to pass on Windows.
905       OPTION(CTEST_TEST_UPDATE_CVS
906         "Enable CTest.UpdateCVS test.  Requires extra CVS setup on windows."
907         OFF)
908       MARK_AS_ADVANCED(CTEST_TEST_UPDATE_CVS)
909     ENDIF(UNIX)
910     IF(CTEST_TEST_UPDATE_CVS)
911       IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
912         FIND_PACKAGE(CVS QUIET)
913       ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
914         FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs)
915         SET(CVS_FOUND ${CVS_EXECUTABLE})
916       ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
917     ENDIF(CTEST_TEST_UPDATE_CVS)
918     IF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND)
919       SET(CTestUpdateCVS_DIR "CTest UpdateCVS")
920       CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in"
921         "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY)
922       ADD_TEST(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND}
923         -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake"
924         )
925       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}")
926     ENDIF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND)
928   ENDIF(CTEST_TEST_UPDATE)
930   IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
931     CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
932       "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
933     ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND}
934       -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V
935       --output-log "${CMake_BINARY_DIR}/Tests/CTestTest/testOutput.log"
936       )
937     CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest2/test.cmake.in"
938       "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" @ONLY ESCAPE_QUOTES)
939     ADD_TEST(CTestTest2 ${CMAKE_CTEST_COMMAND}
940       -S "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" -V
941       --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
942       )
943     CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in"
944       "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES)
945     ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND}
946       -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V
947       --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log"
948       )
949     # these tests take a long time, make sure they have it
950     # if timeouts have not already been set
951     GET_TEST_PROPERTY(CTestTest TIMEOUT PREVIOUS_TIMEOUT)
952     IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
953       SET_TESTS_PROPERTIES ( CTestTest
954         PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
955     ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
957     GET_TEST_PROPERTY(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT)
958     IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
959       SET_TESTS_PROPERTIES ( CTestTest2
960         PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
961     ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
963     GET_TEST_PROPERTY(CTestTest3 TIMEOUT PREVIOUS_TIMEOUT)
964     IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
965       SET_TESTS_PROPERTIES ( CTestTest3
966         PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
967     ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
968   ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
969   
970   IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
971     SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
972   ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
973   IF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
974     # If there is CMakeLists.txt in the binary tree, assume in-source build
975     SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
976   ENDIF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
977   IF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
980     ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND}
981       --build-and-test
982       ${CMake_SOURCE_DIR}
983       ${CMake_BINARY_DIR}/Tests/BootstrapTest
984       --build-nocmake
985       --build-noclean
986       --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap
987       --build-generator "${CMAKE_TEST_GENERATOR}"
988       --test-command 
989       ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake)
990     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
992     # provide more time for the bootstrap test
993     GET_TEST_PROPERTY(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
994     IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
995       SET_TESTS_PROPERTIES ( BootstrapTest
996         PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
997     ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
998   ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
1000   # fortran does not work for IDE builds because
1001   # CMAKE_STANDARD_LIBRARIES needs to be per language
1002   IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles"
1003      OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
1004     # see if we can find a fortran compiler on the machine
1005     # if so, add the fortran test and see if it works.
1006     SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95
1007       lf95 xlf95 fort gfortran gfortran-4 f90  pgf90   xlf90
1008       epcf90 f77  fort77 frt pgf77  xlf  fl32 af77 g77  )
1009     FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES 
1010       ${CMAKE_Fortran_COMPILER_LIST} )
1011     MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER_FULLPATH)
1012     IF(CMAKE_Fortran_COMPILER_FULLPATH)
1013       ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
1014         --build-and-test
1015         "${CMake_SOURCE_DIR}/Tests/Fortran"
1016         "${CMake_BINARY_DIR}/Tests/Fortran"
1017         --build-generator ${CMAKE_TEST_GENERATOR}
1018         --build-project testf
1019         --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
1020         --build-two-config
1021         --test-command testf)
1022       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
1023     ENDIF(CMAKE_Fortran_COMPILER_FULLPATH)
1024   ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles"
1025      OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
1027   IF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode")
1028     INCLUDE(FindJava)
1029     IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
1030       GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
1031       FIND_FILE(JNI_H jni.h
1032         "${JNIPATH}/../include"
1033         "${JNIPATH}/../java/include")
1034       IF(JNI_H)
1035         FILE(READ "${JNI_H}" JNI_FILE)
1036         IF("${JNI_FILE}" MATCHES "JDK1_2")
1037           ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
1038             --build-and-test
1039             "${CMake_SOURCE_DIR}/Tests/Java"
1040             "${CMake_BINARY_DIR}/Tests/Java"
1041             --build-generator ${CMAKE_TEST_GENERATOR}
1042             --build-project hello
1043             --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
1044             --build-two-config
1045             --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
1046             --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
1047           LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java")
1048         ENDIF("${JNI_FILE}" MATCHES "JDK1_2")
1049       ENDIF(JNI_H)
1050     ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
1051   ENDIF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode")
1053   # add some cross compiler tests, for now only with makefile based generators
1054   IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
1056     # if sdcc is found, build the SimpleCOnly project with sdcc
1057     FIND_PROGRAM(SDCC_EXECUTABLE sdcc)
1058     MARK_AS_ADVANCED(SDCC_EXECUTABLE)
1059     IF(SDCC_EXECUTABLE)
1060       ADD_TEST(SimpleCOnly_sdcc ${CMAKE_CTEST_COMMAND}
1061         --build-and-test
1062         "${CMake_SOURCE_DIR}/Tests/SimpleCOnly"
1063         "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc"
1064         --build-generator ${CMAKE_TEST_GENERATOR}
1065         --build-project SimpleC
1066         --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
1067         --build-options
1068         "-DCMAKE_SYSTEM_NAME=Generic"
1069         "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}")
1070       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc")
1071     ENDIF(SDCC_EXECUTABLE)
1072     
1073     
1074     FIND_PROGRAM(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc)
1075     FIND_PROGRAM(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++)
1076     MARK_AS_ADVANCED(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE)
1077     IF(MINGW_CC_LINUX2WIN_EXECUTABLE  AND  MINGW_CXX_LINUX2WIN_EXECUTABLE)
1078       ADD_TEST(Simple_Mingw_Linux2Win ${CMAKE_CTEST_COMMAND}
1079         --build-and-test
1080         "${CMake_SOURCE_DIR}/Tests/Simple"
1081         "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win"
1082         --build-generator ${CMAKE_TEST_GENERATOR}
1083         --build-project Simple
1084         --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
1085         --build-options
1086         "-DCMAKE_SYSTEM_NAME=Windows"
1087         "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}"
1088         "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}")
1089       LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win")
1090     ENDIF(MINGW_CC_LINUX2WIN_EXECUTABLE  AND  MINGW_CXX_LINUX2WIN_EXECUTABLE)
1091     
1092     
1093   ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
1095   IF(BUILD_WXDialog AND wxWidgets_CONFIG_EXECUTABLE)
1096     # Will be set if the WX gui is on
1097     ADD_TEST(UseWX ${CMAKE_CTEST_COMMAND}
1098       --build-and-test
1099       "${CMake_SOURCE_DIR}/Tests/UseWX"
1100       "${CMake_BINARY_DIR}/Tests/UseWX"
1101       --build-generator ${CMAKE_TEST_GENERATOR}
1102       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
1103       --build-exe-dir ${CMake_BINARY_DIR}/Tests/UseWX
1104       --build-project UsewxWidgets
1105       --build-options -DwxWidgets_CONFIG_EXECUTABLE=${wxWidgets_CONFIG_EXECUTABLE}
1106       --test-command UseWX
1107       )
1108     LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/UseWX")
1109   ENDIF(BUILD_WXDialog AND wxWidgets_CONFIG_EXECUTABLE)
1111   IF(UNIX)
1112     STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix"
1113       PREFIX_IS_FOR_TEST)
1114     IF(PREFIX_IS_FOR_TEST)
1115       CONFIGURE_FILE(
1116         ${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in
1117         ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh
1118         @ONLY IMMEDIATE
1119         )
1120       ADD_TEST(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh)
1121     ENDIF(PREFIX_IS_FOR_TEST)
1122   ENDIF(UNIX)
1124   IF(CMAKE_TEST_PLPLOT_DIR)
1125     ADD_TEST(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake )
1126     SET_TESTS_PROPERTIES ( plplot PROPERTIES TIMEOUT 5400)
1127   ENDIF(CMAKE_TEST_PLPLOT_DIR)
1129   IF(CMAKE_TEST_CHICKEN_DIR)
1130     ADD_TEST(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake )
1131     SET_TESTS_PROPERTIES ( Chicken PROPERTIES TIMEOUT 5400)
1132   ENDIF(CMAKE_TEST_CHICKEN_DIR)
1134   IF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
1135     ADD_TEST(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake )
1136     SET_TESTS_PROPERTIES ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
1137   ENDIF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
1139   # If this is not an in-source build, provide a target to wipe out
1140   # all the test build directories.
1141   IF(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
1142     CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in
1143                    ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY)
1144     ADD_CUSTOM_TARGET(test_clean
1145       COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake
1146       COMMENT "Removing test build directories."
1147       )
1148   ENDIF(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
1150 ENDIF(BUILD_TESTING)
1152 SUBDIRS(CMakeTests)