BUG: Do not add Qt wrapping test unless QT is found and QT_UIC_EXECUTABLE is found.
[cmake.git] / Source / CMakeLists.txt
blobbadbf768298a2ee5dd1a2143387f309203a52317
1 CMAKE_MINIMUM_REQUIRED(VERSION 1.5)
3 # configure the .h file
4 CONFIGURE_FILE(
5   "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
6   "${CMake_BINARY_DIR}/Source/cmConfigure.h"
7   )
9 # add the include path to find the .h 
10 INCLUDE_DIRECTORIES(
11   "${CMake_BINARY_DIR}/Source"
12   "${CMake_SOURCE_DIR}/Source"
13   )
15 # let cmake know it is supposed to use it
16 ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
19 # Sources for CMakeLib
21 SET(SRCS
22   cmBootstrapCommands.cxx
23   cmCacheManager.cxx
24   cmCacheManager.h
25   cmCommands.cxx
26   cmCommands.h
27   cmCustomCommand.cxx
28   cmCustomCommand.h
29   cmDepends.cxx
30   cmDepends.h
31   cmDependsC.cxx
32   cmDependsC.h
33   cmDependsFortran.cxx
34   cmDependsFortran.h
35   cmDependsFortranLexer.cxx
36   cmDependsFortranParser.cxx
37   cmDependsFortranParser.h
38   cmDependsJava.cxx
39   cmDependsJava.h
40   cmDependsJavaLexer.cxx
41   cmDependsJavaParser.cxx
42   cmDependsJavaParserHelper.cxx
43   cmDependsJavaParserHelper.h
44   cmDocumentation.cxx
45   cmDynamicLoader.cxx
46   cmDynamicLoader.h
47   cmGeneratedFileStream.cxx
48   cmGlob.cxx
49   cmGlobalGenerator.cxx
50   cmGlobalGenerator.h
51   cmGlobalUnixMakefileGenerator.cxx
52   cmGlobalUnixMakefileGenerator.h
53   cmListFileCache.cxx
54   cmListFileCache.h
55   cmListFileLexer.c
56   cmLocalGenerator.cxx
57   cmLocalGenerator.h
58   cmLocalUnixMakefileGenerator2.cxx
59   cmMakeDepend.cxx
60   cmMakeDepend.h
61   cmMakefile.cxx
62   cmMakefile.h
63   cmOrderLinkDirectories.cxx
64   cmSourceFile.cxx
65   cmSourceFile.h
66   cmSourceGroup.cxx
67   cmSourceGroup.h
68   cmSystemTools.cxx
69   cmSystemTools.h
70   cmTarget.cxx
71   cmTarget.h
72   cmVariableWatch.cxx
73   cmVariableWatch.h
74   cmVersion.cxx
75   cmVersion.h
76   cmXMLParser.cxx
77   cmXMLParser.h
78   cmake.cxx
79   cmake.h
80   cmakewizard.cxx
81   cmakewizard.h
82   )
84 # Kdevelop only works on UNIX and not windows
85 IF(UNIX)
86   SET(SRCS ${SRCS}
87     cmGlobalKdevelopGenerator.cxx
88     cmLocalKdevelopGenerator.cxx)
89 ENDIF(UNIX)
90 # XCode only works on apple
91 IF(APPLE)
92   SET(SRCS ${SRCS}
93     cmXCodeObject.cxx
94     cmGlobalXCodeGenerator.cxx
95     cmLocalXCodeGenerator.cxx
96     cmLocalXCodeGenerator.h)
97 ENDIF(APPLE)
100 IF (WIN32)
101   IF(NOT UNIX)
102     SET(SRCS ${SRCS}
103       cmGlobalBorlandMakefileGenerator.cxx
104       cmGlobalNMakeMakefileGenerator.cxx
105       cmGlobalVisualStudio6Generator.cxx
106       cmLocalVisualStudio6Generator.cxx
107       cmGlobalBorlandMakefileGenerator.h
108       cmGlobalNMakeMakefileGenerator.h
109       cmGlobalVisualStudio6Generator.h
110       cmLocalVisualStudio6Generator.h
111       cmWin32ProcessExecution.cxx
112       cmWin32ProcessExecution.h
113       )
114     IF(NOT MINGW)
115       SET(SRCS ${SRCS}
116         cmGlobalVisualStudio71Generator.h
117         cmGlobalVisualStudio8Generator.h
118         cmGlobalVisualStudio7Generator.h
119         cmLocalVisualStudio7Generator.h
120         cmGlobalVisualStudio8Generator.cxx
121         cmGlobalVisualStudio71Generator.cxx
122         cmGlobalVisualStudio7Generator.cxx
123         cmLocalVisualStudio7Generator.cxx)
124     ENDIF(NOT MINGW)
125   ENDIF(NOT UNIX)
126 ENDIF (WIN32)
128 # create a library used by the command line and the GUI
129 ADD_LIBRARY(CMakeLib ${SRCS})
130 TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} cmzlib)
131 IF (UNIX)
132   TARGET_LINK_LIBRARIES(CMakeLib ${CMAKE_DL_LIBS})
133 ENDIF (UNIX)
134 IF(CMAKE_BUILD_ON_VISUAL_STUDIO)
135   # On Visual Studio we need rpcrt4.lib for cmVisualStudio7 generator.
136   TARGET_LINK_LIBRARIES(CMakeLib rpcrt4.lib)
137 ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO)
140 # CTestLib
142 INCLUDE_DIRECTORIES(
143   "${CMAKE_SOURCE_DIR}/Source/CTest"
144   ${CMAKE_XMLRPC_INCLUDES}
145   )
147 # Sources for CTestLib
149 SET(CMTEST_SRCS cmCTest.cxx 
150   CTest/cmCTestGenericHandler.cxx
151   CTest/cmCTestBuildHandler.cxx
152   CTest/cmCTestConfigureHandler.cxx
153   CTest/cmCTestCoverageHandler.cxx
154   CTest/cmCTestScriptHandler.cxx
155   CTest/cmCTestTestHandler.cxx
156   CTest/cmCTestUpdateHandler.cxx
157   CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
158   CTest/cmCTestRunScriptCommand.cxx
159   CTest/cmCTestSleepCommand.cxx
160   CTest/cmCTestStartCommand.cxx
161   CTest/cmCTestUpdateCommand.cxx
162   CTest/cmCTestMemCheckHandler.cxx
163   CTest/cmCTestSubmit.cxx
164   )
166 # Build CTestLib
167 ADD_LIBRARY(CTestLib ${CMTEST_SRCS})
168 TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES})
170 # Build CMake executable
171 ADD_EXECUTABLE(cmake cmakemain.cxx)
172 TARGET_LINK_LIBRARIES(cmake CMakeLib)
173 ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
174 TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib)
176 # Build special executable for running programs on Windows 98
177 IF(WIN32)
178   IF(NOT UNIX)
179     ADD_EXECUTABLE(cmw9xcom cmw9xcom.cxx)
180     TARGET_LINK_LIBRARIES(cmw9xcom CMakeLib)
181   ENDIF(NOT UNIX)
182 ENDIF(WIN32)
184 # Build CTest executable
185 ADD_EXECUTABLE(ctest ctest.cxx)
186 TARGET_LINK_LIBRARIES(ctest CTestLib)
188 # Curses GUI
189 IF (UNIX)
190   INCLUDE (${CMake_SOURCE_DIR}/Modules/FindCurses.cmake OPTIONAL)
191   IF (CURSES_LIBRARY)
192     INCLUDE(${CMake_SOURCE_DIR}/Source/CursesDialog/CMakeLists.txt)
193   ENDIF (CURSES_LIBRARY)
194 ENDIF (UNIX)
196 # MFC GUI
197 # MFC libraries are only available on Visual Studio
198 IF(CMAKE_BUILD_ON_VISUAL_STUDIO)
199   SUBDIRS(MFCDialog)
200 ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO)
202 # WX Widgets GUI
203 OPTION(CMAKE_BUILD_WX_DIALOG "Build wxWidgets dialog for CMake" FALSE)
204 MARK_AS_ADVANCED(CMAKE_BUILD_WX_DIALOG)
205 IF(CMAKE_BUILD_WX_DIALOG)
206   SUBDIRS(WXDialog)
207 ENDIF(CMAKE_BUILD_WX_DIALOG)
209 # Testing
210 IF (NOT DART_ROOT)
211   SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
212 ENDIF (NOT DART_ROOT)
214 IF(BUILD_TESTING)
215   # This variable is set by cmake, however to
216   # test cmake we want to make sure that 
217   # the ctest from this cmake is used for testing
218   # and not the ctest from the cmake building and testing
219   # cmake.
220   SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
222   # Should the long tests be run?
223   OPTION(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON)
224   MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS)
226   ADD_TEST(CommandLineTest ${CMAKE_CTEST_COMMAND}
227     --build-and-test 
228     "${CMake_SOURCE_DIR}/Tests/CommandLineTest"
229     "${CMake_BINARY_DIR}/Tests/CommandLineTest"
230     --build-two-config 
231     --build-generator ${CMAKE_GENERATOR}
232     --build-makeprogram ${MAKEPROGRAM}
233     --build-project CommandLineTest
234     --test-command CommandLineTest)
236   ADD_TEST(CustomCommand  ${CMAKE_CTEST_COMMAND}
237     --build-and-test 
238     "${CMake_SOURCE_DIR}/Tests/CustomCommand"
239     "${CMake_BINARY_DIR}/Tests/CustomCommand"
240     --build-two-config
241     --build-generator ${CMAKE_GENERATOR}
242     --build-project CustomCommand
243     --build-makeprogram ${MAKEPROGRAM}
244     --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
245     --test-command CustomCommand
246     )
248   ADD_TEST(FindPackageTest ${CMAKE_CTEST_COMMAND}
249     --build-and-test 
250     "${CMake_SOURCE_DIR}/Tests/FindPackageTest"
251     "${CMake_BINARY_DIR}/Tests/FindPackageTest"
252     --build-two-config
253     --build-generator ${CMAKE_GENERATOR}
254     --build-project FindPackageTest
255     --build-makeprogram ${MAKEPROGRAM}
256     --test-command FindPackageTest)
258   ADD_TEST(SystemInformation ${CMAKE_CTEST_COMMAND}
259     --build-and-test 
260     "${CMake_SOURCE_DIR}/Tests/SystemInformation"
261     "${CMake_BINARY_DIR}/Tests/SystemInformation"
262     --build-two-config
263     --build-generator ${CMAKE_GENERATOR}
264     --build-project DumpInformation
265     --build-makeprogram ${MAKEPROGRAM}
266     --test-command DumpInformation)
268   ADD_TEST(StringFileTest ${CMAKE_CTEST_COMMAND}
269     --build-and-test 
270     "${CMake_SOURCE_DIR}/Tests/StringFileTest"
271     "${CMake_BINARY_DIR}/Tests/StringFileTest"
272     --build-two-config
273     --build-generator ${CMAKE_GENERATOR}
274     --build-project StringFileTest
275     --build-makeprogram ${MAKEPROGRAM}
276     --test-command StringFileTest)
278   ADD_TEST(TryCompile ${CMAKE_CTEST_COMMAND}
279     --build-and-test
280     "${CMake_SOURCE_DIR}/Tests/TryCompile"
281     "${CMake_BINARY_DIR}/Tests/TryCompile"
282     --build-generator ${CMAKE_GENERATOR}
283     --build-project TryCompile
284     --build-makeprogram ${MAKEPROGRAM}
285     --build-two-config
286     --test-command TryCompile)
288   ADD_TEST(simple ${CMAKE_CTEST_COMMAND}
289     --build-and-test 
290     "${CMake_SOURCE_DIR}/Tests/Simple"
291     "${CMake_BINARY_DIR}/Tests/Simple"
292     --build-generator ${CMAKE_GENERATOR}
293     --build-project Simple
294     --build-makeprogram ${MAKEPROGRAM}
295     --build-two-config
296     --test-command simple)
298   ADD_TEST(OutOfSource ${CMAKE_CTEST_COMMAND}
299     --build-and-test 
300     "${CMake_SOURCE_DIR}/Tests/OutOfSource"
301     "${CMake_BINARY_DIR}/Tests/OutOfSource"
302     --build-generator ${CMAKE_GENERATOR}
303     --build-project OutOfSource
304     --build-makeprogram ${MAKEPROGRAM}
305     --build-two-config
306     --test-command 
307     "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
309   ADD_TEST(PreOrder ${CMAKE_CTEST_COMMAND}
310     --build-and-test 
311     "${CMake_SOURCE_DIR}/Tests/PreOrder"
312     "${CMake_BINARY_DIR}/Tests/PreOrder"
313     --build-generator ${CMAKE_GENERATOR}
314     --build-project PreOrder
315     --build-makeprogram ${MAKEPROGRAM}
316     --build-two-config
317     --test-command simple)
319   ADD_TEST(conly  ${CMAKE_CTEST_COMMAND}
320     --build-and-test 
321     "${CMake_SOURCE_DIR}/Tests/COnly"
322     "${CMake_BINARY_DIR}/Tests/COnly"
323     --build-generator ${CMAKE_GENERATOR}
324     --build-project conly
325     --build-makeprogram ${MAKEPROGRAM}
326     --build-two-config
327     --test-command   conly)
329   SET(SimpleInstallInstallDir 
330     "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
331   ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
332     --build-and-test 
333     "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
334     "${CMake_BINARY_DIR}/Tests/SimpleInstall"
335     --build-generator ${CMAKE_GENERATOR}
336     --build-project TestSimpleInstall
337     --build-makeprogram ${MAKEPROGRAM}
338     --build-two-config
339     --build-options
340     "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
341     --test-command   ${SimpleInstallInstallDir}/bin/SimpleInstall)
342   ADD_TEST(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
343     --build-and-test 
344     "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
345     "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
346     --build-generator ${CMAKE_GENERATOR}
347     --build-project TestSimpleInstall
348     --build-makeprogram ${MAKEPROGRAM}
349     --build-two-config
350     --build-options
351     "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
352     "-DSTAGE2:BOOL=1"
353     --test-command   ${SimpleInstallInstallDir}/bin/SimpleInstallS2)
355   ADD_TEST(X11  ${CMAKE_CTEST_COMMAND}
356     --build-and-test 
357     "${CMake_SOURCE_DIR}/Tests/X11"
358     "${CMake_BINARY_DIR}/Tests/X11"
359     --build-generator ${CMAKE_GENERATOR}
360     --build-project UseX11
361     --build-makeprogram ${MAKEPROGRAM}
362     --build-two-config
363     --test-command  UseX11)
365   ADD_TEST(LoadedCommand  ${CMAKE_CTEST_COMMAND}
366     --build-and-test 
367     "${CMake_SOURCE_DIR}/Tests/LoadCommand"
368     "${CMake_BINARY_DIR}/Tests/LoadCommand"
369     --build-generator ${CMAKE_GENERATOR}
370     --build-project LoadedCommand
371     --build-makeprogram ${MAKEPROGRAM}
372     --build-two-config
373     --test-command  LoadedCommand)
375   ADD_TEST(LoadedCommandOneConfig  ${CMAKE_CTEST_COMMAND}
376     --build-and-test 
377     "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
378     "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
379     --build-generator ${CMAKE_GENERATOR}
380     --build-project LoadedCommand
381     --build-makeprogram ${MAKEPROGRAM}
382     --test-command  LoadedCommand 
383     )
385   # Como does not seem to support shared libraries.
386   GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
387   IF(CMAKE_BASE_NAME MATCHES "^como$")
388     SET(COMPILER_IS_COMO 1)
389   ENDIF(CMAKE_BASE_NAME MATCHES "^como$")
390   IF(NOT COMPILER_IS_COMO)
391     ADD_TEST(complex   ${CMAKE_CTEST_COMMAND}
392       --build-and-test 
393       "${CMake_SOURCE_DIR}/Tests/Complex"
394       "${CMake_BINARY_DIR}/Tests/Complex"
395       --build-two-config
396       --build-generator ${CMAKE_GENERATOR}
397       --build-project complex
398       --build-makeprogram ${MAKEPROGRAM}
399       --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
400       --test-command complex 
401       )
403     ADD_TEST(complexOneConfig  ${CMAKE_CTEST_COMMAND}
404       --build-and-test
405       "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
406       "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
407       --build-generator ${CMAKE_GENERATOR}
408       --build-project complex
409       --build-makeprogram ${MAKEPROGRAM}
410       --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
411       --test-command complex)
413     ADD_TEST(complexRelativePaths  ${CMAKE_CTEST_COMMAND}
414       --build-and-test
415       "${CMake_SOURCE_DIR}/Tests/ComplexRelativePaths"
416       "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths"
417       --build-generator ${CMAKE_GENERATOR}
418       --build-project complex
419       --build-makeprogram ${MAKEPROGRAM}
420       --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths/bin" 
421       --build-options -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON
422       --test-command complex)
424   ENDIF(NOT COMPILER_IS_COMO)
426   ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
427     --build-and-test
428     "${CMake_SOURCE_DIR}/Example"
429     "${CMake_BINARY_DIR}/Example"
430     --build-generator ${CMAKE_GENERATOR}
431     --build-project HELLO
432     --build-makeprogram ${MAKEPROGRAM}
433     --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo"
434     --test-command helloDemo
435     )
437   ADD_TEST(testing ${CMAKE_CTEST_COMMAND}
438     --build-and-test
439     "${CMake_SOURCE_DIR}/Tests/Testing"
440     "${CMake_BINARY_DIR}/Tests/Testing"
441     --build-generator ${CMAKE_GENERATOR}
442     --build-project testing
443     --build-makeprogram ${MAKEPROGRAM}
444     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Testing/bin"
445     --test-command testing
446     )
448   ADD_TEST(wrapping  ${CMAKE_CTEST_COMMAND}
449     --build-and-test
450     "${CMake_SOURCE_DIR}/Tests/Wrapping"
451     "${CMake_BINARY_DIR}/Tests/Wrapping"
452     --build-generator ${CMAKE_GENERATOR}
453     --build-project wrapping
454     --build-makeprogram ${MAKEPROGRAM}
455     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
456     --test-command wrapping
457     )
459   INCLUDE ( ${CMAKE_ROOT}/Modules/FindQt.cmake )
460   MARK_AS_ADVANCED(
461     QT_INCLUDE_PATH
462     QT_MOC_EXE
463     QT_QT_LIBRARY
464     QT_UIC_EXE)
466   IF (QT_FOUND AND QT_UIC_EXECUTABLE)
467     ADD_TEST(qtwrapping  ${CMAKE_CTEST_COMMAND}
468       --build-and-test
469       "${CMake_SOURCE_DIR}/Tests/Wrapping"
470       "${CMake_BINARY_DIR}/Tests/Wrapping"
471       --build-generator ${CMAKE_GENERATOR}
472       --build-project Wrapping
473       --build-makeprogram ${MAKEPROGRAM}
474       --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
475       --test-command qtwrapping
476       )
477   ENDIF (QT_FOUND AND QT_UIC_EXECUTABLE)
479   ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND}
480     --build-and-test
481     "${CMake_SOURCE_DIR}/Tests/TestDriver"
482     "${CMake_BINARY_DIR}/Tests/TestDriver"
483     --build-generator ${CMAKE_GENERATOR}
484     --build-makeprogram ${MAKEPROGRAM}
485     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
486     --build-project TestDriverTest
487     --test-command TestDriverTest test1
488     )
490   ADD_TEST(testdriver2 ${CMAKE_CTEST_COMMAND}
491     --build-and-test
492     "${CMake_SOURCE_DIR}/Tests/TestDriver"
493     "${CMake_BINARY_DIR}/Tests/TestDriver"
494     --build-generator ${CMAKE_GENERATOR}
495     --build-makeprogram ${MAKEPROGRAM}
496     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
497     --build-project TestDriverTest
498     --test-command TestDriverTest test2
499     )
501   ADD_TEST(testdriver3  ${CMAKE_CTEST_COMMAND}
502     --build-and-test
503     "${CMake_SOURCE_DIR}/Tests/TestDriver"
504     "${CMake_BINARY_DIR}/Tests/TestDriver"
505     --build-generator ${CMAKE_GENERATOR}
506     --build-makeprogram ${MAKEPROGRAM}
507     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
508     --build-project TestDriverTest
509     --test-command TestDriverTest subdir/test3
510     )
512   ADD_TEST(dependency_w_libout  ${CMAKE_CTEST_COMMAND}
513     --build-and-test
514     "${CMake_SOURCE_DIR}/Tests/Dependency"
515     "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
516     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec"
517     --build-project Dependency 
518     --build-generator ${CMAKE_GENERATOR}
519     --build-makeprogram ${MAKEPROGRAM}
520     --build-options
521     -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
522     --test-command exec
523     )
526   ADD_TEST(dependency_wo_lib_out   ${CMAKE_CTEST_COMMAND}
527     --build-and-test
528     "${CMake_SOURCE_DIR}/Tests/Dependency"
529     "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut"
530     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut/Exec"
531     --build-generator ${CMAKE_GENERATOR}
532     --build-makeprogram ${MAKEPROGRAM}
533     --build-project Dependency 
534     --test-command exec
535     )
537   ADD_TEST(dependency2  ${CMAKE_CTEST_COMMAND}
538     --build-and-test
539     "${CMake_SOURCE_DIR}/Tests/Dependency"
540     "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut" 
541     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec2"
542     --build-generator ${CMAKE_GENERATOR}
543     --build-makeprogram ${MAKEPROGRAM}
544     --build-project Dependency 
545     --build-options
546     -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
547     --test-command exec2
548     )
550   ADD_TEST(dependency3  ${CMAKE_CTEST_COMMAND}
551     --build-and-test
552     "${CMake_SOURCE_DIR}/Tests/Dependency"
553     "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
554     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec3"
555     --build-generator ${CMAKE_GENERATOR}
556     --build-makeprogram ${MAKEPROGRAM}
557     --build-project Dependency 
558     --build-options
559     -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
560     --test-command exec3)
562   ADD_TEST(dependency4   ${CMAKE_CTEST_COMMAND}
563     --build-and-test
564     "${CMake_SOURCE_DIR}/Tests/Dependency"
565     "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
566     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec4"
567     --build-generator ${CMAKE_GENERATOR}
568     --build-makeprogram ${MAKEPROGRAM}
569     --build-project Dependency 
570     --build-options
571     -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
572     --test-command exec4
573     )
575   ADD_TEST(JumpWithLibOut  ${CMAKE_CTEST_COMMAND}
576     --build-and-test
577     "${CMake_SOURCE_DIR}/Tests/Jump"
578     "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut"
579     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable"
580     --build-project Jump
581     --build-generator ${CMAKE_GENERATOR}
582     --build-makeprogram ${MAKEPROGRAM}
583     --build-options
584     -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib
585     --test-command jumpExecutable
586     )
588   ADD_TEST(JumpNoLibOut  ${CMAKE_CTEST_COMMAND}
589     --build-and-test
590     "${CMake_SOURCE_DIR}/Tests/Jump"
591     "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut"
592     --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
593     --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
594     --build-project Jump 
595     --build-generator ${CMAKE_GENERATOR}
596     --build-makeprogram ${MAKEPROGRAM}
597     --test-command jumpExecutable
598     )
600   ADD_TEST(linkline   ${CMAKE_CTEST_COMMAND}
601     --build-and-test
602     "${CMake_SOURCE_DIR}/Tests/LinkLine"
603     "${CMake_BINARY_DIR}/Tests/LinkLine"
604     --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLine"
605     --build-generator ${CMAKE_GENERATOR}
606     --build-makeprogram ${MAKEPROGRAM}
607     --build-project Linkline
608     --test-command Exec
609     )
611   ADD_TEST(linkorder1 ${CMAKE_CTEST_COMMAND}
612     --build-and-test
613     "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
614     "${CMake_BINARY_DIR}/Tests/LinkLineOrder" 
615     --build-generator ${CMAKE_GENERATOR}
616     --build-makeprogram ${MAKEPROGRAM}
617     --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
618     --build-project LinkLineOrder
619     --test-command Exec1
620     )
622   ADD_TEST(linkorder2  ${CMAKE_CTEST_COMMAND}
623     --build-and-test
624     "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
625     "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
626     --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
627     --build-generator ${CMAKE_GENERATOR}
628     --build-makeprogram ${MAKEPROGRAM}
629     --build-project LinkLineOrder
630     --test-command Exec2
631     )
633   ADD_TEST(ExternalOBJ ${CMAKE_CTEST_COMMAND}
634     --build-and-test
635     "${CMake_SOURCE_DIR}/Tests/ExternalOBJ"
636     "${CMake_BINARY_DIR}/Tests/ExternalOBJ"
637     --build-generator ${CMAKE_GENERATOR}
638     --build-project ExternalOBJ
639     --build-makeprogram ${MAKEPROGRAM}
640     --build-exe-dir "${CMake_BINARY_DIR}/ExternalOBJ"
641     --test-command executable
642     )
644   ADD_TEST(curl ${CMAKE_CTEST_COMMAND}
645     --build-and-test
646     "${CMake_SOURCE_DIR}/Source/CTest/Curl"
647     "${CMake_BINARY_DIR}/Tests/Curl"  
648     --build-generator ${CMAKE_GENERATOR}
649     --build-makeprogram ${MAKEPROGRAM}
650     --build-project LIBCURL
651     --test-command LIBCURL)
653   ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND}
654     --build-and-test
655     "${CMake_SOURCE_DIR}/Source/kwsys"
656     "${CMake_BINARY_DIR}/Tests/kwsys"
657     --build-exe-dir "${CMake_BINARY_DIR}/Tests/kwsys"
658     --build-generator ${CMAKE_GENERATOR}
659     --build-makeprogram ${MAKEPROGRAM}
660     --build-project kwsys
661     --test-command  test1
662     )
664   IF (WIN32)
665     ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
666       --build-and-test
667       "${CMake_SOURCE_DIR}/Tests/SubDir"
668       "${CMake_BINARY_DIR}/Tests/SubDir"
669       --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
670       --build-generator ${CMAKE_GENERATOR}
671       --build-makeprogram ${MAKEPROGRAM}
672       --build-project SUBDIR
673       --test-command test 
674       "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
675       "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
676       )
677   ELSE (WIN32)
678     ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
679       --build-and-test
680       "${CMake_SOURCE_DIR}/Tests/SubDir"
681       "${CMake_BINARY_DIR}/Tests/SubDir"
682       --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
683       --build-generator ${CMAKE_GENERATOR}
684       --build-makeprogram ${MAKEPROGRAM}
685       --build-project SUBDIR
686       --test-command test 
687       "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
688       "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
689       )
690   ENDIF (WIN32)    
692   IF("${CMAKE_GENERATOR}" MATCHES "Makefile")
693     ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND}
694       --build-and-test
695       "${CMake_SOURCE_DIR}/Tests/MakeClean"
696       "${CMake_BINARY_DIR}/Tests/MakeClean"
697       --build-generator ${CMAKE_GENERATOR}
698       --build-project MakeClean
699       --build-makeprogram ${MAKEPROGRAM}
700       --build-exe-dir "${CMake_BINARY_DIR}/MakeClean"
701       --test-command check_clean
702       )
703   ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile")
705   IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
706     ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND}
707       --build-and-test 
708       "${CMake_SOURCE_DIR}/Tests/VSExternalInclude"
709       "${CMake_BINARY_DIR}/Tests/VSExternalInclude"
710       --build-two-config
711       --build-generator ${CMAKE_GENERATOR}
712       --build-project VSExternalInclude
713       --build-makeprogram ${MAKEPROGRAM}
714       --test-command VSExternalInclude)
715   ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
717   IF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
718     ADD_TEST(objc++ ${CMAKE_CTEST_COMMAND}
719       --build-and-test
720       "${CMake_SOURCE_DIR}/Tests/Objc++"
721       "${CMake_BINARY_DIR}/Tests/Objc++"
722       --build-generator ${CMAKE_GENERATOR}
723       --build-makeprogram ${MAKEPROGRAM}
724       --build-project  objc++
725       --test-command  objc++
726       )
727   ENDIF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
729   IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
730     CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
731       "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
732     ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND}
733       -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V
734       )
735   ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
737   IF("${CMAKE_GENERATOR}" MATCHES XCode)
738     SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
739   ENDIF("${CMAKE_GENERATOR}" MATCHES XCode)
740   IF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
741     ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND}
742       --build-and-test
743       ${CMake_SOURCE_DIR}
744       ${CMake_BINARY_DIR}/Tests/BootstrapTest
745       --build-nocmake 
746       --build-noclean
747       --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap
748       --build-generator "${CMAKE_GENERATOR}"
749       --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake)
750   ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
752   IF(CMAKE_GENERATOR MATCHES "Makefiles")
753     # see if we can find a fortran compiler on the machine
754     # if so, add the fortran test and see if it works.
755     SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 
756       lf95 xlf95 fort gfortran f90  pgf90   xlf90  
757       epcf90 f77  fort77 frt pgf77  xlf  fl32 af77 g77  )
758     FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES ${CMAKE_Fortran_COMPILER_LIST} )
759     MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER_FULLPATH)
760     IF(CMAKE_Fortran_COMPILER_FULLPATH)
761       ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
762         --build-and-test 
763         "${CMake_SOURCE_DIR}/Tests/Fortran"
764         "${CMake_BINARY_DIR}/Tests/Fortran"
765         --build-generator ${CMAKE_GENERATOR}
766         --build-project testf
767         --build-makeprogram ${MAKEPROGRAM}
768         --build-two-config
769         --test-command testf)
770     ENDIF(CMAKE_Fortran_COMPILER_FULLPATH)
772     INCLUDE(FindJava)
773     IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE)
774       GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
775       FIND_FILE(JNI_H jni.h
776         "${JNIPATH}/../include"
777         "${JNIPATH}/../java/include")
778       IF(JNI_H)
779         FILE(READ "${JNI_H}" JNI_FILE)
780         IF("${JNI_FILE}" MATCHES "JDK1_2")
781           ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
782             --build-and-test 
783             "${CMake_SOURCE_DIR}/Tests/Java"
784             "${CMake_BINARY_DIR}/Tests/Java"
785             --build-generator ${CMAKE_GENERATOR}
786             --build-project hello
787             --build-makeprogram ${MAKEPROGRAM}
788             --build-two-config 
789             --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
790             --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
791         ELSE("${JNI_FILE}" MATCHES "JDK1_2")
792           MESSAGE(STATUS "No Java Test because ${JNI_H} does not contain JDK1_2 define")
793         ENDIF("${JNI_FILE}" MATCHES "JDK1_2")
794       ELSE(JNI_H) 
795         MESSAGE(STATUS "No Java Test because jni.h could not be found. tried:\n${JNIPATH}/../include and ${JNIPATH}/../java/include")
796       ENDIF(JNI_H) 
797     ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE)
798   ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
800   IF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR)
801     # Will be set if the wxwindows gui is on
802     ADD_TEST(UseWX ${CMAKE_CTEST_COMMAND}
803       --build-and-test
804       "${CMake_SOURCE_DIR}/Tests/UseWX"
805       "${CMake_BINARY_DIR}/Tests/UseWX"
806       --build-generator ${CMAKE_GENERATOR}
807       --build-makeprogram ${MAKEPROGRAM}
808       --build-exe-dir ${CMake_BINARY_DIR}/Tests/UseWX
809       --build-project UsewxWindows
810       --build-options -DCMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE:FILEPATH=${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
811       --test-command UseWX
812       )
813   ENDIF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR)
815   IF(UNIX)
816     STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix"
817       PREFIX_IS_FOR_TEST)
818     IF(PREFIX_IS_FOR_TEST)
819       CONFIGURE_FILE(
820         ${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in
821         ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh
822         @ONLY IMMEDIATE
823         )
824       ADD_TEST(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh)
825     ENDIF(PREFIX_IS_FOR_TEST)
826   ENDIF(UNIX)
828 ENDIF(BUILD_TESTING)
830 INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
831 INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
833 INSTALL_TARGETS(/bin cmake)
834 INSTALL_TARGETS(/bin ctest)
835 INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h)