CMakeLists.txt 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534
  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)
  15. # Make sure the 'testing' test gets a proper configuration.
  16. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
  17. ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
  18. SET_DIRECTORY_PROPERTIES(PROPERTIES
  19. TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake"
  20. )
  21. # Testing
  22. IF(BUILD_TESTING)
  23. # Collect a list of all test build directories.
  24. SET(TEST_BUILD_DIRS)
  25. # Should the long tests be run?
  26. OPTION(CMAKE_RUN_LONG_TESTS
  27. "Should the long tests be run (such as Bootstrap)." ON)
  28. MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS)
  29. IF (CMAKE_RUN_LONG_TESTS)
  30. OPTION(CTEST_TEST_CTEST
  31. "Should the tests that run a full sub ctest process be run?"
  32. OFF)
  33. MARK_AS_ADVANCED(CTEST_TEST_CTEST)
  34. OPTION(TEST_KDE4_STABLE_BRANCH
  35. "Should the KDE4 stable branch test be run?"
  36. OFF)
  37. MARK_AS_ADVANCED(TEST_KDE4_STABLE_BRANCH)
  38. ENDIF (CMAKE_RUN_LONG_TESTS)
  39. # Should tests that use CVS be run?
  40. #
  41. set(do_cvs_tests 0)
  42. if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  43. find_package(CVS QUIET)
  44. else(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  45. find_program(CVS_EXECUTABLE NAMES cvs)
  46. endif(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  47. if(CVS_EXECUTABLE)
  48. set(do_cvs_tests 1)
  49. endif(CVS_EXECUTABLE)
  50. if(do_cvs_tests AND NOT UNIX)
  51. if("${CVS_EXECUTABLE}" MATCHES "cygwin")
  52. set(do_cvs_tests 0)
  53. endif("${CVS_EXECUTABLE}" MATCHES "cygwin")
  54. endif(do_cvs_tests AND NOT UNIX)
  55. # Should CPack tests be run? By default, yes, but...
  56. #
  57. # Disable packaging test on Apple 10.3 and below. PackageMaker starts
  58. # DiskManagementTool as root and disowns it
  59. # (http://lists.apple.com/archives/installer-dev/2005/Jul/msg00005.html).
  60. # It is left holding open pipe handles and preventing ProcessUNIX from
  61. # detecting end-of-data even after its immediate child exits. Then
  62. # the test hangs until it times out and is killed. This is a
  63. # well-known bug in kwsys process execution that I would love to get
  64. # time to fix.
  65. #
  66. OPTION(CTEST_TEST_CPACK
  67. "Should the tests that use '--build-target package' be run?"
  68. ON)
  69. MARK_AS_ADVANCED(CTEST_TEST_CPACK)
  70. SET(CTEST_TEST_OSX_ARCH 0)
  71. IF(APPLE)
  72. EXECUTE_PROCESS(
  73. COMMAND sw_vers -productVersion
  74. OUTPUT_VARIABLE OSX_VERSION
  75. OUTPUT_STRIP_TRAILING_WHITESPACE
  76. )
  77. IF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
  78. MESSAGE(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4")
  79. MESSAGE(STATUS "OSX_VERSION='${OSX_VERSION}'")
  80. SET(CTEST_TEST_CPACK OFF)
  81. ELSE(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
  82. SET(CTEST_TEST_OSX_ARCH 1)
  83. ENDIF(OSX_VERSION MATCHES "^10\\.[0123]" OR OSX_VERSION MATCHES "ProductVersion:\t10\\.[0123]")
  84. ENDIF(APPLE)
  85. # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
  86. # whichever is greater.
  87. SET(CMAKE_LONG_TEST_TIMEOUT 1500)
  88. IF(CTEST_TEST_TIMEOUT)
  89. SET(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT})
  90. ENDIF(CTEST_TEST_TIMEOUT)
  91. IF(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
  92. SET(CMAKE_LONG_TEST_TIMEOUT 1500)
  93. ENDIF(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
  94. # add a bunch of standard build-and-test style tests
  95. ADD_TEST_MACRO(CommandLineTest CommandLineTest)
  96. ADD_TEST_MACRO(FindPackageTest FindPackageTest)
  97. ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
  98. ADD_TEST_MACRO(StringFileTest StringFileTest)
  99. ADD_TEST_MACRO(TryCompile TryCompile)
  100. ADD_TEST_MACRO(TarTest TarTest)
  101. ADD_TEST_MACRO(SystemInformation SystemInformation)
  102. ADD_TEST_MACRO(MathTest MathTest)
  103. ADD_TEST_MACRO(Simple Simple)
  104. ADD_TEST_MACRO(PreOrder PreOrder)
  105. ADD_TEST_MACRO(COnly COnly)
  106. ADD_TEST_MACRO(CxxOnly CxxOnly)
  107. ADD_TEST_MACRO(IPO COnly/COnly)
  108. ADD_TEST_MACRO(OutDir runtime/OutDir)
  109. ADD_TEST_MACRO(NewlineArgs NewlineArgs)
  110. ADD_TEST_MACRO(SetLang SetLang)
  111. ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
  112. ADD_TEST_MACRO(LoadCommand LoadedCommand)
  113. ADD_TEST_MACRO(LinkLanguage LinkLanguage)
  114. ADD_TEST_MACRO(LinkLine LinkLine)
  115. ADD_TEST_MACRO(MacroTest miniMacroTest)
  116. ADD_TEST_MACRO(FunctionTest miniFunctionTest)
  117. ADD_TEST_MACRO(ReturnTest ReturnTest)
  118. ADD_TEST_MACRO(Properties Properties)
  119. ADD_TEST_MACRO(Assembler HelloAsm)
  120. ADD_TEST_MACRO(SourceGroups SourceGroups)
  121. ADD_TEST_MACRO(Preprocess Preprocess)
  122. ADD_TEST_MACRO(ExportImport ExportImport)
  123. ADD_TEST_MACRO(Unset Unset)
  124. ADD_TEST_MACRO(PolicyScope PolicyScope)
  125. IF("${CMAKE_TEST_GENERATOR}" MATCHES "Make")
  126. ADD_TEST_MACRO(Policy0002 Policy0002)
  127. ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Make")
  128. IF(CTEST_TEST_OSX_ARCH)
  129. ADD_TEST_MACRO(Architecture Architecture)
  130. SET_TESTS_PROPERTIES(Architecture PROPERTIES
  131. PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype)")
  132. ENDIF(CTEST_TEST_OSX_ARCH)
  133. SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
  134. SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
  135. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
  136. "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY)
  137. ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P
  138. "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake")
  139. # If we are running right now with a UnixMakefiles based generator,
  140. # build the "Simple" test with the ExtraGenerators, if available
  141. # This doesn't test whether the generated project files work (unfortunately),
  142. # mainly it tests that cmake doesn't crash when generating these project files.
  143. IF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
  144. # check which generators we have
  145. EXEC_PROGRAM(${CMAKE_CMAKE_COMMAND} ARGS --help OUTPUT_VARIABLE cmakeOutput )
  146. # check for the Eclipse generator
  147. IF ("${cmakeOutput}" MATCHES Eclipse)
  148. ADD_TEST(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
  149. --build-and-test
  150. "${CMake_SOURCE_DIR}/Tests/Simple"
  151. "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator"
  152. --build-two-config
  153. --build-generator "Eclipse CDT4 - Unix Makefiles"
  154. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  155. --build-project Simple
  156. --test-command Simple)
  157. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator")
  158. ENDIF ("${cmakeOutput}" MATCHES Eclipse)
  159. # check for the CodeBlocks generator
  160. IF ("${cmakeOutput}" MATCHES CodeBlocks)
  161. ADD_TEST(Simple_CodeBlocksGenerator ${CMAKE_CTEST_COMMAND}
  162. --build-and-test
  163. "${CMake_SOURCE_DIR}/Tests/Simple"
  164. "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator"
  165. --build-two-config
  166. --build-generator "CodeBlocks - Unix Makefiles"
  167. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  168. --build-project Simple
  169. --test-command Simple)
  170. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator")
  171. ENDIF ("${cmakeOutput}" MATCHES CodeBlocks)
  172. # check for the KDevelop3 generator
  173. IF ("${cmakeOutput}" MATCHES KDevelop3)
  174. ADD_TEST(Simple_KDevelop3Generator ${CMAKE_CTEST_COMMAND}
  175. --build-and-test
  176. "${CMake_SOURCE_DIR}/Tests/Simple"
  177. "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator"
  178. --build-two-config
  179. --build-generator "KDevelop3 - Unix Makefiles"
  180. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  181. --build-project Simple
  182. --test-command Simple)
  183. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator")
  184. ENDIF ("${cmakeOutput}" MATCHES KDevelop3)
  185. ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
  186. # test for correct sub-project generation
  187. # not implemented in VS6 or Xcode
  188. IF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70)
  189. # run cmake and configure all of SubProject
  190. # but only build the independent executable car
  191. ADD_TEST(SubProject ${CMAKE_CTEST_COMMAND}
  192. --build-and-test
  193. "${CMake_SOURCE_DIR}/Tests/SubProject"
  194. "${CMake_BINARY_DIR}/Tests/SubProject"
  195. --build-project SubProject
  196. --build-generator ${CMAKE_TEST_GENERATOR}
  197. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  198. --build-target car
  199. --test-command car
  200. )
  201. # For stage 2, do not run cmake again.
  202. # Then build the foo sub project which should build
  203. # the bar library which should be referenced because
  204. # foo links to the static library bar, but bar is not
  205. # directly in the foo sub project
  206. ADD_TEST(SubProject-Stage2 ${CMAKE_CTEST_COMMAND}
  207. --build-and-test
  208. "${CMake_SOURCE_DIR}/Tests/SubProject/foo"
  209. "${CMake_BINARY_DIR}/Tests/SubProject/foo"
  210. --build-generator ${CMAKE_TEST_GENERATOR}
  211. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  212. --build-nocmake
  213. --build-project foo
  214. --build-target foo
  215. --test-command foo
  216. )
  217. SET_TESTS_PROPERTIES ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
  218. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
  219. ENDIF(NOT MSVC60 AND NOT XCODE AND NOT MSVC70)
  220. IF (CMAKE_STRICT)
  221. ADD_TEST_MACRO(DocTest DocTest)
  222. ENDIF (CMAKE_STRICT)
  223. # macro to add a test that will build a nightly release
  224. # of CMake for given platform using the release scripts
  225. MACRO(ADD_NIGHTLY_BUILD_TEST name script)
  226. SET(_TEST_DIR "${CMake_BINARY_DIR}/Tests/${name}")
  227. FILE(MAKE_DIRECTORY "${_TEST_DIR}")
  228. FILE(WRITE "${_TEST_DIR}/nightly-cmake.sh"
  229. "cd ${_TEST_DIR}
  230. ${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
  231. ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
  232. ")
  233. ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
  234. IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
  235. SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  236. ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
  237. ENDMACRO(ADD_NIGHTLY_BUILD_TEST)
  238. IF(CMAKE_BUILD_NIGHTLY_RELEASES)
  239. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows
  240. dash2win64_release.cmake)
  241. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyMac
  242. dashmacmini2_release.cmake)
  243. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux
  244. magrathea_release.cmake)
  245. ENDIF(CMAKE_BUILD_NIGHTLY_RELEASES)
  246. # add tests with more complex invocations
  247. ADD_TEST(Framework ${CMAKE_CTEST_COMMAND}
  248. --build-and-test
  249. "${CMake_SOURCE_DIR}/Tests/Framework"
  250. "${CMake_BINARY_DIR}/Tests/Framework"
  251. --build-two-config
  252. --build-generator ${CMAKE_TEST_GENERATOR}
  253. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  254. --build-project Framework
  255. --build-options
  256. "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
  257. --test-command bar)
  258. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
  259. ADD_TEST(TargetName ${CMAKE_CTEST_COMMAND}
  260. --build-and-test
  261. "${CMake_SOURCE_DIR}/Tests/TargetName"
  262. "${CMake_BINARY_DIR}/Tests/TargetName"
  263. --build-two-config
  264. --build-generator ${CMAKE_TEST_GENERATOR}
  265. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  266. --build-project TargetName
  267. --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
  268. ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
  269. ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
  270. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName")
  271. ADD_TEST(LibName ${CMAKE_CTEST_COMMAND}
  272. --build-and-test
  273. "${CMake_SOURCE_DIR}/Tests/LibName"
  274. "${CMake_BINARY_DIR}/Tests/LibName"
  275. --build-two-config
  276. --build-generator ${CMAKE_TEST_GENERATOR}
  277. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  278. --build-project LibName
  279. --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
  280. --test-command foobar
  281. )
  282. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")
  283. ADD_TEST(CustComDepend ${CMAKE_CTEST_COMMAND}
  284. --build-and-test
  285. "${CMake_SOURCE_DIR}/Tests/CustComDepend"
  286. "${CMake_BINARY_DIR}/Tests/CustComDepend"
  287. --build-two-config
  288. --build-generator ${CMAKE_TEST_GENERATOR}
  289. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  290. --build-project CustComDepend
  291. --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
  292. --test-command foo bar.c
  293. )
  294. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend")
  295. ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND}
  296. --build-and-test
  297. "${CMake_SOURCE_DIR}/Tests/CustomCommand"
  298. "${CMake_BINARY_DIR}/Tests/CustomCommand"
  299. --build-two-config
  300. --build-generator ${CMAKE_TEST_GENERATOR}
  301. --build-project CustomCommand
  302. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  303. --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
  304. --test-command CustomCommand
  305. )
  306. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
  307. ADD_TEST(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND}
  308. --build-and-test
  309. "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory"
  310. "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory"
  311. --build-two-config
  312. --build-generator ${CMAKE_TEST_GENERATOR}
  313. --build-project TestWorkingDir
  314. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  315. --test-command working
  316. )
  317. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory")
  318. #ADD_TEST(SimpleExclude ${CMAKE_CTEST_COMMAND}
  319. # --build-and-test
  320. # "${CMake_SOURCE_DIR}/Tests/SimpleExclude"
  321. # "${CMake_BINARY_DIR}/Tests/SimpleExclude"
  322. # --build-generator ${CMAKE_TEST_GENERATOR}
  323. # --build-project SimpleExclude
  324. # --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  325. # --build-two-config
  326. # --test-command t4
  327. #--test-command "${CMAKE_COMMAND}"
  328. #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
  329. #-P "${CMAKE_BINARY_DIR}/Tests/SimpleExclude/run.cmake"
  330. #)
  331. # ADD_TEST(SameName ${CMAKE_CTEST_COMMAND}
  332. # --build-and-test
  333. # "${CMake_SOURCE_DIR}/Tests/SameName"
  334. # "${CMake_BINARY_DIR}/Tests/SameName"
  335. # --build-generator ${CMAKE_TEST_GENERATOR}
  336. # --build-project SameName
  337. # --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  338. # --build-two-config
  339. # --test-command
  340. # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2")
  341. ADD_TEST(OutOfSource ${CMAKE_CTEST_COMMAND}
  342. --build-and-test
  343. "${CMake_SOURCE_DIR}/Tests/OutOfSource"
  344. "${CMake_BINARY_DIR}/Tests/OutOfSource"
  345. --build-generator ${CMAKE_TEST_GENERATOR}
  346. --build-project OutOfSource
  347. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  348. --build-two-config
  349. --test-command
  350. "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
  351. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource")
  352. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep")
  353. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary")
  354. ADD_TEST(BuildDepends ${CMAKE_CTEST_COMMAND}
  355. --build-and-test
  356. "${CMake_SOURCE_DIR}/Tests/BuildDepends"
  357. "${CMake_BINARY_DIR}/Tests/BuildDepends"
  358. --build-generator ${CMAKE_TEST_GENERATOR}
  359. --build-project BuildDepends
  360. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  361. )
  362. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
  363. SET(SimpleInstallInstallDir
  364. "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
  365. ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
  366. --build-and-test
  367. "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
  368. "${CMake_BINARY_DIR}/Tests/SimpleInstall"
  369. --build-generator ${CMAKE_TEST_GENERATOR}
  370. --build-project TestSimpleInstall
  371. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  372. --build-two-config
  373. --build-options
  374. "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
  375. --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
  376. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
  377. ADD_TEST(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
  378. --build-and-test
  379. "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
  380. "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
  381. --build-generator ${CMAKE_TEST_GENERATOR}
  382. --build-project TestSimpleInstall
  383. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  384. --build-two-config
  385. --build-options
  386. "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
  387. "-DSTAGE2:BOOL=1"
  388. --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
  389. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
  390. # By default, run the CPackComponents test if the CTEST_TEST_CPACK
  391. # option is ON:
  392. #
  393. set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
  394. set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
  395. find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
  396. PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
  397. DOC "makensis program location"
  398. )
  399. # But on Windows, only run the CPackComponents test if the NSIS
  400. # installer builder is available:
  401. #
  402. if(WIN32)
  403. if(NSIS_MAKENSIS_EXECUTABLE)
  404. set(CTEST_RUN_CPackComponents ON)
  405. else(NSIS_MAKENSIS_EXECUTABLE)
  406. set(CTEST_RUN_CPackComponents OFF)
  407. set(CTEST_package_X11_TEST OFF)
  408. endif(NSIS_MAKENSIS_EXECUTABLE)
  409. endif(WIN32)
  410. IF(CTEST_RUN_CPackComponents)
  411. set(CPackComponents_EXTRA_OPTIONS)
  412. if(APPLE)
  413. set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
  414. endif(APPLE)
  415. if(NSIS_MAKENSIS_EXECUTABLE)
  416. set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS}
  417. -DCPACK_BINARY_NSIS:BOOL=ON)
  418. endif(NSIS_MAKENSIS_EXECUTABLE)
  419. ADD_TEST(CPackComponents ${CMAKE_CTEST_COMMAND}
  420. --build-and-test
  421. "${CMake_SOURCE_DIR}/Tests/CPackComponents"
  422. "${CMake_BINARY_DIR}/Tests/CPackComponents"
  423. --build-generator ${CMAKE_TEST_GENERATOR}
  424. --build-project CPackComponents
  425. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  426. --build-two-config
  427. --build-target package
  428. --build-options
  429. -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
  430. -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
  431. ${CPackComponents_EXTRA_OPTIONS}
  432. --graphviz=CPackComponents.dot
  433. --test-command ${CMAKE_CMAKE_COMMAND}
  434. "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
  435. -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
  436. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
  437. ENDIF(CTEST_RUN_CPackComponents)
  438. # By default, turn this test off (because it takes a long time...)
  439. #
  440. if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
  441. set(CTEST_RUN_CPackTestAllGenerators OFF)
  442. # ...but: if it appears to be a coverage dashboard, or long tests are
  443. # on, then set it to the generic CTEST_TEST_CPACK setting.
  444. #
  445. if(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR
  446. NOT "$ENV{COVFILE}" STREQUAL "" OR
  447. CMAKE_RUN_LONG_TESTS)
  448. set(CTEST_RUN_CPackTestAllGenerators ${CTEST_TEST_CPACK})
  449. endif(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR
  450. NOT "$ENV{COVFILE}" STREQUAL "" OR
  451. CMAKE_RUN_LONG_TESTS)
  452. endif(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
  453. IF(CTEST_RUN_CPackTestAllGenerators)
  454. ADD_TEST(CPackTestAllGenerators ${CMAKE_CTEST_COMMAND}
  455. --build-and-test
  456. "${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators"
  457. "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators"
  458. --build-generator ${CMAKE_TEST_GENERATOR}
  459. --build-project CPackTestAllGenerators
  460. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  461. --test-command
  462. ${CMAKE_CMAKE_COMMAND}
  463. -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators
  464. -D cpack=${CMAKE_CPACK_COMMAND}
  465. -P ${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators/RunCPack.cmake
  466. )
  467. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators")
  468. ENDIF(CTEST_RUN_CPackTestAllGenerators)
  469. IF(CTEST_package_X11_TEST)
  470. SET(X11_build_target_arg --build-target package)
  471. ELSE(CTEST_package_X11_TEST)
  472. SET(X11_build_target_arg)
  473. ENDIF(CTEST_package_X11_TEST)
  474. ADD_TEST(X11 ${CMAKE_CTEST_COMMAND}
  475. --build-and-test
  476. "${CMake_SOURCE_DIR}/Tests/X11"
  477. "${CMake_BINARY_DIR}/Tests/X11"
  478. --build-generator ${CMAKE_TEST_GENERATOR}
  479. --build-project UseX11
  480. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  481. --build-two-config
  482. ${X11_build_target_arg}
  483. --test-command UseX11)
  484. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11")
  485. if(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators)
  486. set(CTEST_RUN_CMakeTestAllGenerators ON)
  487. endif(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators)
  488. IF(CTEST_RUN_CMakeTestAllGenerators)
  489. ADD_TEST(CMakeTestAllGenerators ${CMAKE_CMAKE_COMMAND}
  490. -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators
  491. -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
  492. -P ${CMake_SOURCE_DIR}/Tests/CMakeTestAllGenerators/RunCMake.cmake
  493. )
  494. LIST(APPEND TEST_BUILD_DIRS
  495. "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators")
  496. ENDIF(CTEST_RUN_CMakeTestAllGenerators)
  497. if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
  498. set(CTEST_RUN_CMakeTestBadCommandLines ON)
  499. endif(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
  500. IF(CTEST_RUN_CMakeTestBadCommandLines)
  501. ADD_TEST(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND}
  502. -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines
  503. -D gen=${CMAKE_TEST_GENERATOR}
  504. -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
  505. -P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake
  506. )
  507. LIST(APPEND TEST_BUILD_DIRS
  508. "${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines")
  509. ENDIF(CTEST_RUN_CMakeTestBadCommandLines)
  510. if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
  511. set(CTEST_RUN_CMakeTestMultipleConfigures ON)
  512. endif(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
  513. IF(CTEST_RUN_CMakeTestMultipleConfigures)
  514. ADD_TEST(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND}
  515. -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures
  516. -D gen=${CMAKE_TEST_GENERATOR}
  517. -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
  518. -P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
  519. )
  520. LIST(APPEND TEST_BUILD_DIRS
  521. "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures")
  522. ENDIF(CTEST_RUN_CMakeTestMultipleConfigures)
  523. ADD_TEST(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
  524. --build-and-test
  525. "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
  526. "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
  527. --build-generator ${CMAKE_TEST_GENERATOR}
  528. --build-project LoadCommand
  529. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  530. --test-command LoadedCommand
  531. )
  532. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
  533. # Como does not seem to support shared libraries.
  534. GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
  535. IF(CMAKE_BASE_NAME MATCHES "^como$")
  536. SET(COMPILER_IS_COMO 1)
  537. ENDIF(CMAKE_BASE_NAME MATCHES "^como$")
  538. IF(NOT COMPILER_IS_COMO)
  539. SET(COMPLEX_TEST_CMAKELIB 1)
  540. IF(CMAKE_TEST_DIFFERENT_GENERATOR OR CMAKE_TEST_SYSTEM_LIBRARIES)
  541. SET(COMPLEX_TEST_CMAKELIB 0)
  542. ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR OR CMAKE_TEST_SYSTEM_LIBRARIES)
  543. IF(BORLAND)
  544. SET(COMPLEX_TEST_CMAKELIB 0)
  545. ENDIF(BORLAND)
  546. ADD_TEST(complex ${CMAKE_CTEST_COMMAND}
  547. --build-and-test
  548. "${CMake_SOURCE_DIR}/Tests/Complex"
  549. "${CMake_BINARY_DIR}/Tests/Complex"
  550. --build-two-config
  551. --build-config-sample "${CMAKE_CTEST_COMMAND}"
  552. --build-generator ${CMAKE_TEST_GENERATOR}
  553. --build-project Complex
  554. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  555. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
  556. --build-options
  557. -DCOMPLEX_TEST_CMAKELIB:BOOL=${COMPLEX_TEST_CMAKELIB}
  558. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  559. --test-command complex
  560. )
  561. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex")
  562. ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND}
  563. --build-and-test
  564. "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
  565. "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
  566. --build-generator ${CMAKE_TEST_GENERATOR}
  567. --build-project Complex
  568. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  569. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
  570. --build-options
  571. -DCOMPLEX_TEST_CMAKELIB:BOOL=${COMPLEX_TEST_CMAKELIB}
  572. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  573. --test-command complex)
  574. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
  575. # because of the registry write these tests depend on each other
  576. SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig)
  577. # This fails on VS 70
  578. # works on Xcode and makefiles
  579. # ADD_TEST(ConvLibrary ${CMAKE_CTEST_COMMAND}
  580. # --build-and-test
  581. # "${CMake_SOURCE_DIR}/Tests/ConvLibrary"
  582. # "${CMake_BINARY_DIR}/Tests/ConvLibrary"
  583. # --build-two-config
  584. # --build-generator ${CMAKE_TEST_GENERATOR}
  585. # --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  586. # --build-project ConvLibrary
  587. # --test-command bartest)
  588. # ADD_TEST(complexRelativePaths ${CMAKE_CTEST_COMMAND}
  589. # --build-and-test
  590. # "${CMake_SOURCE_DIR}/Tests/ComplexRelativePaths"
  591. # "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths"
  592. # --build-generator ${CMAKE_TEST_GENERATOR}
  593. # --build-project complex
  594. # --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  595. # --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths/bin"
  596. # --build-options -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON
  597. # --test-command complex)
  598. ENDIF(NOT COMPILER_IS_COMO)
  599. ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
  600. --build-and-test
  601. "${CMake_SOURCE_DIR}/Example"
  602. "${CMake_BINARY_DIR}/Example"
  603. --build-generator ${CMAKE_TEST_GENERATOR}
  604. --build-project HELLO
  605. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  606. --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo"
  607. --test-command helloDemo
  608. )
  609. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Example")
  610. ADD_TEST(Environment ${CMAKE_CTEST_COMMAND}
  611. --build-and-test
  612. "${CMake_SOURCE_DIR}/Tests/Environment"
  613. "${CMake_BINARY_DIR}/Tests/Environment"
  614. --build-generator ${CMAKE_TEST_GENERATOR}
  615. --build-project EnvironmentProj
  616. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  617. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment"
  618. --force-new-ctest-process
  619. --test-command ${CMAKE_CTEST_COMMAND} -V
  620. )
  621. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
  622. ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND}
  623. --build-and-test
  624. "${CMake_SOURCE_DIR}/Tests/ExternalProject"
  625. "${CMake_BINARY_DIR}/Tests/ExternalProject"
  626. --build-generator ${CMAKE_TEST_GENERATOR}
  627. --build-project ExternalProjectTest
  628. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  629. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject"
  630. --force-new-ctest-process
  631. --test-command ${CMAKE_CTEST_COMMAND} -V
  632. )
  633. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
  634. # The ExternalProject test takes 900 seconds on some machines!
  635. GET_TEST_PROPERTY(ExternalProject TIMEOUT PREVIOUS_TIMEOUT)
  636. IF("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  637. SET_TESTS_PROPERTIES(ExternalProject PROPERTIES TIMEOUT 1000)
  638. ENDIF("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  639. # do each of the tutorial steps
  640. FOREACH(STP RANGE 1 7)
  641. ADD_TEST(TutorialStep${STP} ${CMAKE_CTEST_COMMAND}
  642. --build-and-test
  643. "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}"
  644. "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}"
  645. --build-two-config
  646. --build-generator ${CMAKE_TEST_GENERATOR}
  647. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  648. --build-project Tutorial
  649. --test-command Tutorial 25.0)
  650. ENDFOREACH(STP)
  651. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial")
  652. ADD_TEST(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  653. --build-and-test
  654. "${CMake_SOURCE_DIR}/Tests/Testing"
  655. "${CMake_BINARY_DIR}/Tests/Testing"
  656. --build-generator ${CMAKE_TEST_GENERATOR}
  657. --build-project Testing
  658. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  659. --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  660. )
  661. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing")
  662. ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND}
  663. --build-and-test
  664. "${CMake_SOURCE_DIR}/Tests/Wrapping"
  665. "${CMake_BINARY_DIR}/Tests/Wrapping"
  666. --build-generator ${CMAKE_TEST_GENERATOR}
  667. --build-project Wrapping
  668. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  669. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  670. --test-command wrapping
  671. )
  672. ADD_TEST(qtwrapping ${CMAKE_CTEST_COMMAND}
  673. --build-and-test
  674. "${CMake_SOURCE_DIR}/Tests/Wrapping"
  675. "${CMake_BINARY_DIR}/Tests/Wrapping"
  676. --build-generator ${CMAKE_TEST_GENERATOR}
  677. --build-project Wrapping
  678. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  679. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  680. --test-command qtwrapping
  681. )
  682. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping")
  683. ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND}
  684. --build-and-test
  685. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  686. "${CMake_BINARY_DIR}/Tests/TestDriver"
  687. --build-generator ${CMAKE_TEST_GENERATOR}
  688. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  689. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  690. --build-project TestDriverTest
  691. --test-command TestDriverTest test1
  692. )
  693. ADD_TEST(testdriver2 ${CMAKE_CTEST_COMMAND}
  694. --build-and-test
  695. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  696. "${CMake_BINARY_DIR}/Tests/TestDriver"
  697. --build-generator ${CMAKE_TEST_GENERATOR}
  698. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  699. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  700. --build-project TestDriverTest
  701. --test-command TestDriverTest test2
  702. )
  703. ADD_TEST(testdriver3 ${CMAKE_CTEST_COMMAND}
  704. --build-and-test
  705. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  706. "${CMake_BINARY_DIR}/Tests/TestDriver"
  707. --build-generator ${CMAKE_TEST_GENERATOR}
  708. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  709. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  710. --build-project TestDriverTest
  711. --test-command TestDriverTest subdir/test3
  712. )
  713. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver")
  714. ADD_TEST(Dependency ${CMAKE_CTEST_COMMAND}
  715. --build-and-test
  716. "${CMake_SOURCE_DIR}/Tests/Dependency"
  717. "${CMake_BINARY_DIR}/Tests/Dependency"
  718. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
  719. --build-generator ${CMAKE_TEST_GENERATOR}
  720. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  721. --build-project Dependency
  722. --test-command exec
  723. )
  724. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency")
  725. IF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  726. # RPATH isn't supported under Syllable, so the tests don't
  727. # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR
  728. # in the tests would have to be adjusted to ${EXECUTABLE_OUTPUT_DIR}/lib .
  729. # For now we just require on Syllable that the user adjusts the DLL_PATH
  730. # environment variable, so except the two tests below all other tests will succeed.
  731. SET(_DLL_PATH "$ENV{DLL_PATH}")
  732. IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$")
  733. 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")
  734. ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$")
  735. IF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$")
  736. 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")
  737. ENDIF(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$")
  738. ELSE("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  739. ADD_TEST(JumpWithLibOut ${CMAKE_CTEST_COMMAND}
  740. --build-and-test
  741. "${CMake_SOURCE_DIR}/Tests/Jump"
  742. "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut"
  743. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable"
  744. --build-project Jump
  745. --build-generator ${CMAKE_TEST_GENERATOR}
  746. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  747. --build-options
  748. -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib
  749. --test-command jumpExecutable
  750. )
  751. ADD_TEST(JumpNoLibOut ${CMAKE_CTEST_COMMAND}
  752. --build-and-test
  753. "${CMake_SOURCE_DIR}/Tests/Jump"
  754. "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut"
  755. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
  756. --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
  757. --build-project Jump
  758. --build-generator ${CMAKE_TEST_GENERATOR}
  759. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  760. --test-command jumpExecutable
  761. )
  762. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump")
  763. ADD_TEST(Plugin ${CMAKE_CTEST_COMMAND}
  764. --build-and-test
  765. "${CMake_SOURCE_DIR}/Tests/Plugin"
  766. "${CMake_BINARY_DIR}/Tests/Plugin"
  767. --build-generator ${CMAKE_TEST_GENERATOR}
  768. --build-project Plugin
  769. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  770. --build-two-config
  771. --test-command bin/example)
  772. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin")
  773. IF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
  774. ADD_TEST_MACRO(RuntimePath RuntimePath)
  775. ENDIF(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
  776. ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
  777. ADD_TEST(linkorder1 ${CMAKE_CTEST_COMMAND}
  778. --build-and-test
  779. "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
  780. "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
  781. --build-generator ${CMAKE_TEST_GENERATOR}
  782. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  783. --build-project LinkLineOrder
  784. --test-command Exec1
  785. )
  786. ADD_TEST(linkorder2 ${CMAKE_CTEST_COMMAND}
  787. --build-and-test
  788. "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
  789. "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
  790. --build-generator ${CMAKE_TEST_GENERATOR}
  791. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  792. --build-project LinkLineOrder
  793. --test-command Exec2
  794. )
  795. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
  796. SET_TESTS_PROPERTIES ( qtwrapping PROPERTIES DEPENDS wrapping)
  797. SET_TESTS_PROPERTIES ( testdriver1 PROPERTIES DEPENDS qtwrapping)
  798. SET_TESTS_PROPERTIES ( testdriver2 PROPERTIES DEPENDS testdriver1)
  799. SET_TESTS_PROPERTIES ( testdriver3 PROPERTIES DEPENDS testdriver2)
  800. SET_TESTS_PROPERTIES ( linkorder2 PROPERTIES DEPENDS linkorder1)
  801. SET_TESTS_PROPERTIES ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall)
  802. IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
  803. ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND}
  804. --build-and-test
  805. "${CMake_SOURCE_DIR}/Source/kwsys"
  806. "${CMake_BINARY_DIR}/Tests/kwsys"
  807. --build-generator ${CMAKE_TEST_GENERATOR}
  808. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  809. --build-project kwsys
  810. --test-command kwsysTestsCxx testIOS
  811. )
  812. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
  813. ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
  814. SET(MAKE_IS_GNU )
  815. IF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
  816. EXEC_PROGRAM(
  817. ${CMAKE_TEST_MAKEPROGRAM} ARGS no_such_target --version
  818. RETURN_VALUE res OUTPUT_VARIABLE out
  819. )
  820. IF("${res}" EQUAL 0)
  821. IF("${out}" MATCHES "GNU")
  822. SET(MAKE_IS_GNU 1)
  823. ENDIF("${out}" MATCHES "GNU")
  824. ENDIF("${res}" EQUAL 0)
  825. ENDIF(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
  826. # only add this test on platforms that support it
  827. # some old versions of make simply cannot handle spaces in paths
  828. IF (MAKE_IS_GNU OR
  829. "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
  830. "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
  831. ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND}
  832. --build-and-test
  833. "${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
  834. "${CMake_BINARY_DIR}/Tests/SubDirSpaces"
  835. --build-exe-dir
  836. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources"
  837. --build-generator ${CMAKE_TEST_GENERATOR}
  838. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  839. --build-project SUBDIR
  840. --test-command test
  841. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere"
  842. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
  843. )
  844. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces")
  845. ENDIF (MAKE_IS_GNU OR
  846. "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
  847. "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
  848. IF (WIN32)
  849. ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
  850. --build-and-test
  851. "${CMake_SOURCE_DIR}/Tests/SubDir"
  852. "${CMake_BINARY_DIR}/Tests/SubDir"
  853. --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
  854. --build-generator ${CMAKE_TEST_GENERATOR}
  855. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  856. --build-project SUBDIR
  857. --test-command test
  858. "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
  859. "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
  860. )
  861. ELSE (WIN32)
  862. ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND}
  863. --build-and-test
  864. "${CMake_SOURCE_DIR}/Tests/SubDir"
  865. "${CMake_BINARY_DIR}/Tests/SubDir"
  866. --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
  867. --build-generator ${CMAKE_TEST_GENERATOR}
  868. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  869. --build-project SUBDIR
  870. --test-command test
  871. "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
  872. "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
  873. )
  874. ENDIF (WIN32)
  875. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
  876. IF(CMAKE_TEST_MSVC)
  877. ADD_TEST_MACRO(PrecompiledHeader foo)
  878. ADD_TEST_MACRO(ModuleDefinition example_exe)
  879. ENDIF(CMAKE_TEST_MSVC)
  880. IF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
  881. ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND}
  882. --build-and-test
  883. "${CMake_SOURCE_DIR}/Tests/MakeClean"
  884. "${CMake_BINARY_DIR}/Tests/MakeClean"
  885. --build-generator ${CMAKE_TEST_GENERATOR}
  886. --build-project MakeClean
  887. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  888. --build-exe-dir "${CMake_BINARY_DIR}/MakeClean"
  889. --test-command check_clean
  890. )
  891. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
  892. ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
  893. IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
  894. ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND}
  895. --build-and-test
  896. "${CMake_SOURCE_DIR}/Tests/VSExternalInclude"
  897. "${CMake_BINARY_DIR}/Tests/VSExternalInclude"
  898. --build-two-config
  899. --build-generator ${CMAKE_TEST_GENERATOR}
  900. --build-project VSExternalInclude
  901. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  902. --test-command VSExternalInclude)
  903. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude")
  904. ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
  905. IF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
  906. SET(BundleTestInstallDir
  907. "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory")
  908. ADD_TEST(BundleTest ${CMAKE_CTEST_COMMAND}
  909. --build-and-test
  910. "${CMake_SOURCE_DIR}/Tests/BundleTest"
  911. "${CMake_BINARY_DIR}/Tests/BundleTest"
  912. --build-two-config
  913. --build-generator ${CMAKE_TEST_GENERATOR}
  914. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  915. --build-project BundleTest
  916. --build-target install
  917. # --build-target package
  918. --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}"
  919. "-DCMake_SOURCE_DIR:PATH=${CMAKE_SOURCE_DIR}"
  920. --test-command
  921. ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe)
  922. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest")
  923. ADD_TEST_MACRO(ObjC++ ObjC++)
  924. ENDIF (APPLE AND CMAKE_COMPILER_IS_GNUCXX)
  925. IF(APPLE AND CTEST_TEST_CPACK)
  926. ADD_TEST(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
  927. --build-and-test
  928. "${CMake_SOURCE_DIR}/Tests/BundleGeneratorTest"
  929. "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest"
  930. --build-two-config
  931. --build-generator ${CMAKE_TEST_GENERATOR}
  932. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  933. --build-project BundleGeneratorTest
  934. --build-target package
  935. --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
  936. )
  937. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
  938. ENDIF(APPLE AND CTEST_TEST_CPACK)
  939. # Make sure CTest can handle a test with no newline in output.
  940. ADD_TEST(CTest.NoNewline
  941. ${CMAKE_COMMAND} -E echo_append "This line has no newline!")
  942. # A simple test for ctest in script mode
  943. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in"
  944. "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" @ONLY)
  945. # ADD_TEST(CTest.ScriptMode ${CMAKE_CTEST_COMMAND}
  946. # -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake"
  947. # )
  948. SET(CTEST_TEST_UPDATE 1)
  949. IF(CTEST_TEST_UPDATE)
  950. # Test CTest Update with Subversion
  951. FIND_PACKAGE(Subversion QUIET)
  952. IF(Subversion_FOUND)
  953. GET_FILENAME_COMPONENT(_Subversion_BIN_DIR
  954. ${Subversion_SVN_EXECUTABLE} PATH)
  955. FIND_PROGRAM(Subversion_SVNADMIN_EXECUTABLE svnadmin
  956. HINTS ${_Subversion_BIN_DIR}
  957. )
  958. MARK_AS_ADVANCED(Subversion_SVNADMIN_EXECUTABLE)
  959. IF(NOT Subversion_SVNADMIN_EXECUTABLE)
  960. SET(Subversion_FOUND FALSE)
  961. ENDIF(NOT Subversion_SVNADMIN_EXECUTABLE)
  962. ENDIF(Subversion_FOUND)
  963. IF(Subversion_FOUND)
  964. SET(CTestUpdateSVN_DIR "CTest UpdateSVN")
  965. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in"
  966. "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY)
  967. ADD_TEST(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND}
  968. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake"
  969. )
  970. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}")
  971. ENDIF(Subversion_FOUND)
  972. # Test CTest Update with CVS
  973. IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  974. FIND_PACKAGE(CVS QUIET)
  975. ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  976. FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs)
  977. SET(CVS_FOUND ${CVS_EXECUTABLE})
  978. ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  979. SET(CTEST_TEST_UPDATE_CVS ${CVS_FOUND})
  980. IF(CTEST_TEST_UPDATE_CVS AND NOT UNIX)
  981. IF("${CVS_EXECUTABLE}" MATCHES "cygwin")
  982. MESSAGE(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!")
  983. SET(CTEST_TEST_UPDATE_CVS 0)
  984. ENDIF("${CVS_EXECUTABLE}" MATCHES "cygwin")
  985. ENDIF(CTEST_TEST_UPDATE_CVS AND NOT UNIX)
  986. IF(CTEST_TEST_UPDATE_CVS)
  987. SET(CTestUpdateCVS_DIR "CTest UpdateCVS")
  988. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in"
  989. "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY)
  990. ADD_TEST(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND}
  991. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake"
  992. )
  993. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}")
  994. ENDIF(CTEST_TEST_UPDATE_CVS)
  995. # Test CTest Update with BZR
  996. FIND_PROGRAM(BZR_EXECUTABLE NAMES bzr)
  997. MARK_AS_ADVANCED(BZR_EXECUTABLE)
  998. SET(CTEST_TEST_UPDATE_BZR 0)
  999. IF(BZR_EXECUTABLE)
  1000. IF(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1001. SET(CTEST_TEST_UPDATE_BZR 1)
  1002. ENDIF(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1003. ENDIF(BZR_EXECUTABLE)
  1004. IF(CTEST_TEST_UPDATE_BZR)
  1005. # Check if xmloutput plugin is there
  1006. EXECUTE_PROCESS(COMMAND ${BZR_EXECUTABLE} xmlplugins RESULT_VARIABLE xmlplugres
  1007. OUTPUT_QUIET ERROR_QUIET)
  1008. IF( NOT ${xmlplugres} )
  1009. SET(CTestUpdateBZR_DIR "CTest UpdateBZR")
  1010. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in"
  1011. "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" @ONLY)
  1012. ADD_TEST(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND}
  1013. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake"
  1014. )
  1015. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}")
  1016. SET(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale")
  1017. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in"
  1018. "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" @ONLY)
  1019. ADD_TEST(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND}
  1020. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake"
  1021. )
  1022. SET_TESTS_PROPERTIES(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C)
  1023. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}")
  1024. ENDIF( NOT ${xmlplugres} )
  1025. ENDIF(CTEST_TEST_UPDATE_BZR)
  1026. # Test CTest Update with GIT
  1027. FIND_PROGRAM(GIT_EXECUTABLE NAMES git)
  1028. MARK_AS_ADVANCED(GIT_EXECUTABLE)
  1029. SET(CTEST_TEST_UPDATE_GIT 0)
  1030. IF(GIT_EXECUTABLE)
  1031. IF(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1032. SET(CTEST_TEST_UPDATE_GIT 1)
  1033. ENDIF(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1034. ENDIF(GIT_EXECUTABLE)
  1035. IF(CTEST_TEST_UPDATE_GIT)
  1036. SET(CTestUpdateGIT_DIR "CTest UpdateGIT")
  1037. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in"
  1038. "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" @ONLY)
  1039. ADD_TEST(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND}
  1040. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake"
  1041. )
  1042. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}")
  1043. ENDIF(CTEST_TEST_UPDATE_GIT)
  1044. # Test CTest Update with HG
  1045. FIND_PROGRAM(HG_EXECUTABLE NAMES hg)
  1046. MARK_AS_ADVANCED(HG_EXECUTABLE)
  1047. SET(CTEST_TEST_UPDATE_HG 0)
  1048. IF(HG_EXECUTABLE)
  1049. IF(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1050. SET(CTEST_TEST_UPDATE_HG 1)
  1051. ENDIF(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  1052. ENDIF(HG_EXECUTABLE)
  1053. IF(CTEST_TEST_UPDATE_HG)
  1054. SET(CTestUpdateHG_DIR "CTest UpdateHG")
  1055. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in"
  1056. "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" @ONLY)
  1057. ADD_TEST(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND}
  1058. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake"
  1059. )
  1060. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}")
  1061. ENDIF(CTEST_TEST_UPDATE_HG)
  1062. ENDIF(CTEST_TEST_UPDATE)
  1063. CONFIGURE_FILE(
  1064. "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoBuild.cmake.in"
  1065. "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake"
  1066. @ONLY ESCAPE_QUOTES)
  1067. ADD_TEST(CTestTestNoBuild ${CMAKE_CTEST_COMMAND}
  1068. -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake" -V
  1069. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut1.log"
  1070. )
  1071. SET_TESTS_PROPERTIES(CTestTestNoBuild PROPERTIES
  1072. FAIL_REGULAR_EXPRESSION "Error" WILL_FAIL true)
  1073. CONFIGURE_FILE(
  1074. "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoExe.cmake.in"
  1075. "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake"
  1076. @ONLY ESCAPE_QUOTES)
  1077. ADD_TEST(CTestTestNoExe ${CMAKE_CTEST_COMMAND}
  1078. -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake" -V
  1079. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut2.log"
  1080. )
  1081. SET_TESTS_PROPERTIES(CTestTestNoExe PROPERTIES DEPENDS CTestTestNoBuild
  1082. PASS_REGULAR_EXPRESSION "Could not find executable"
  1083. FAIL_REGULAR_EXPRESSION "SegFault")
  1084. CONFIGURE_FILE(
  1085. "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"
  1086. "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake"
  1087. @ONLY ESCAPE_QUOTES)
  1088. ADD_TEST(CTestTestCrash ${CMAKE_CTEST_COMMAND}
  1089. -S "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" -V
  1090. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log"
  1091. )
  1092. # with watcom the SEGFAULT is not found, it just fails
  1093. IF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake")
  1094. SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES
  1095. PASS_REGULAR_EXPRESSION "Failed")
  1096. ELSE(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake")
  1097. SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES
  1098. PASS_REGULAR_EXPRESSION "SegFault")
  1099. ENDIF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake")
  1100. CONFIGURE_FILE(
  1101. "${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in"
  1102. "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake"
  1103. @ONLY ESCAPE_QUOTES)
  1104. ADD_TEST(CTestTestParallel ${CMAKE_CTEST_COMMAND}
  1105. -S "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" -V
  1106. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log"
  1107. )
  1108. CONFIGURE_FILE(
  1109. "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in"
  1110. "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake"
  1111. @ONLY ESCAPE_QUOTES)
  1112. ADD_TEST(CTestTestSubdir ${CMAKE_CTEST_COMMAND}
  1113. -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V
  1114. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log"
  1115. )
  1116. CONFIGURE_FILE(
  1117. "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
  1118. "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake"
  1119. @ONLY ESCAPE_QUOTES)
  1120. ADD_TEST(CTestTestTimeout ${CMAKE_CTEST_COMMAND}
  1121. -S "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" -V
  1122. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log"
  1123. )
  1124. SET_TESTS_PROPERTIES(CTestTestTimeout PROPERTIES
  1125. PASS_REGULAR_EXPRESSION "\\*\\*\\*Timeout")
  1126. CONFIGURE_FILE(
  1127. "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake.in"
  1128. "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake"
  1129. @ONLY ESCAPE_QUOTES)
  1130. CONFIGURE_FILE(
  1131. "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake.in"
  1132. "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/hello.cmake"
  1133. @ONLY ESCAPE_QUOTES)
  1134. ADD_TEST(CTestTestRunScript ${CMAKE_CTEST_COMMAND}
  1135. -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V
  1136. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log"
  1137. )
  1138. ADD_TEST(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
  1139. ADD_TEST(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B)
  1140. # Use macro, not function so that build can still be driven by CMake 2.4.
  1141. # After 2.6 is required, this could be a function without the extra 'set'
  1142. # calls.
  1143. #
  1144. macro(add_failed_submit_test name source build in out log regex)
  1145. # Have variables named source, build and drop_method because the
  1146. # configure_file call expects those variables to be defined.
  1147. #
  1148. set(source "${source}")
  1149. set(build "${build}")
  1150. configure_file("${in}" "${out}" @ONLY)
  1151. add_test(${name} ${CMAKE_CTEST_COMMAND} -S "${out}" -V --output-log "${log}")
  1152. set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
  1153. endmacro()
  1154. set(regex "(Problems when submitting via S*CP")
  1155. set(regex "${regex}|Error message was: ")
  1156. set(regex "${regex}([Cc]ould *n.t resolve host")
  1157. set(regex "${regex}|[Cc]ould *n.t connect to host")
  1158. set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)")
  1159. set(regex "${regex}|Submission method .xmlrpc. not compiled into CTest")
  1160. set(regex "${regex}|Submission successful)")
  1161. set(ctest_coverage_labels_args "")
  1162. foreach(drop_method cp ftp http https scp xmlrpc)
  1163. # Cycle through these values each time through the loop:
  1164. if(ctest_coverage_labels_args STREQUAL "")
  1165. set(ctest_coverage_labels_args "LABELS Everything")
  1166. elseif(ctest_coverage_labels_args STREQUAL "LABELS Everything")
  1167. set(ctest_coverage_labels_args "LABELS 0ArgTest")
  1168. else()
  1169. set(ctest_coverage_labels_args "")
  1170. endif()
  1171. add_failed_submit_test(CTestTestFailedSubmit-${drop_method}
  1172. "${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast"
  1173. "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/${drop_method}"
  1174. "${CMake_SOURCE_DIR}/Tests/CTestTestFailedSubmits/test.cmake.in"
  1175. "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.cmake"
  1176. "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.log"
  1177. "${regex}"
  1178. )
  1179. endforeach()
  1180. IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
  1181. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
  1182. "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
  1183. ADD_TEST(CTestTest ${CMAKE_CTEST_COMMAND}
  1184. -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V
  1185. --output-log "${CMake_BINARY_DIR}/Tests/CTestTest/testOutput.log"
  1186. )
  1187. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest2/test.cmake.in"
  1188. "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" @ONLY ESCAPE_QUOTES)
  1189. ADD_TEST(CTestTest2 ${CMAKE_CTEST_COMMAND}
  1190. -S "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" -V
  1191. --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
  1192. )
  1193. CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in"
  1194. "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES)
  1195. ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND}
  1196. -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V
  1197. --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log"
  1198. )
  1199. # these tests take a long time, make sure they have it
  1200. # if timeouts have not already been set
  1201. GET_TEST_PROPERTY(CTestTest TIMEOUT PREVIOUS_TIMEOUT)
  1202. IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1203. SET_TESTS_PROPERTIES ( CTestTest
  1204. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1205. ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1206. GET_TEST_PROPERTY(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT)
  1207. IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1208. SET_TESTS_PROPERTIES ( CTestTest2
  1209. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1210. ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1211. GET_TEST_PROPERTY(CTestTest3 TIMEOUT PREVIOUS_TIMEOUT)
  1212. IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1213. SET_TESTS_PROPERTIES ( CTestTest3
  1214. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1215. ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1216. ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
  1217. IF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
  1218. IF(UNIX)
  1219. IF(NOT QT4_FOUND)
  1220. FIND_PACKAGE(Qt4)
  1221. ENDIF(NOT QT4_FOUND)
  1222. SET(TRY_BUILD_KDE4 TRUE)
  1223. IF(QT4_FOUND)
  1224. # check whether it's Qt 4.5 in a cmake 2.4. compatible way:
  1225. IF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache")
  1226. SET(TRY_BUILD_KDE4 FALSE)
  1227. ENDIF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache")
  1228. ELSE(QT4_FOUND)
  1229. SET(TRY_BUILD_KDE4 FALSE)
  1230. ENDIF(QT4_FOUND)
  1231. FIND_PACKAGE(Perl)
  1232. IF(NOT PERL_FOUND)
  1233. SET(TRY_BUILD_KDE4 FALSE)
  1234. ENDIF(NOT PERL_FOUND)
  1235. FIND_PACKAGE(ZLIB)
  1236. IF(NOT ZLIB_FOUND)
  1237. SET(TRY_BUILD_KDE4 FALSE)
  1238. ENDIF(NOT ZLIB_FOUND)
  1239. IF(TRY_BUILD_KDE4)
  1240. FILE(MAKE_DIRECTORY ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest)
  1241. SET(TEST_KDE4_BASE_DIR ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest)
  1242. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh.in ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh @ONLY)
  1243. EXECUTE_PROCESS(COMMAND chmod 755 ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh )
  1244. ADD_TEST(KDE4StableBranchTest ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh)
  1245. ENDIF(TRY_BUILD_KDE4)
  1246. ENDIF(UNIX)
  1247. ENDIF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
  1248. IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
  1249. SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
  1250. ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
  1251. IF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
  1252. # If there is CMakeLists.txt in the binary tree, assume in-source build
  1253. SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
  1254. ENDIF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
  1255. IF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
  1256. ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND}
  1257. --build-and-test
  1258. ${CMake_SOURCE_DIR}
  1259. ${CMake_BINARY_DIR}/Tests/BootstrapTest
  1260. --build-nocmake
  1261. --build-noclean
  1262. --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap
  1263. --build-generator "${CMAKE_TEST_GENERATOR}"
  1264. --test-command
  1265. ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake)
  1266. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
  1267. # provide more time for the bootstrap test
  1268. GET_TEST_PROPERTY(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
  1269. IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1270. SET_TESTS_PROPERTIES ( BootstrapTest
  1271. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1272. ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  1273. ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
  1274. # fortran does not work for IDE builds because
  1275. # CMAKE_STANDARD_LIBRARIES needs to be per language
  1276. IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles"
  1277. OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
  1278. # see if we can find a fortran compiler on the machine
  1279. # if so, add the fortran test and see if it works.
  1280. SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95
  1281. lf95 xlf95 fort gfortran gfortran-4 f90 pgf90 xlf90
  1282. epcf90 f77 fort77 frt pgf77 xlf fl32 af77 g77 )
  1283. FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES
  1284. ${CMAKE_Fortran_COMPILER_LIST} )
  1285. MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER_FULLPATH)
  1286. IF(CMAKE_Fortran_COMPILER_FULLPATH)
  1287. ADD_TEST(Fortran ${CMAKE_CTEST_COMMAND}
  1288. --build-and-test
  1289. "${CMake_SOURCE_DIR}/Tests/Fortran"
  1290. "${CMake_BINARY_DIR}/Tests/Fortran"
  1291. --build-generator ${CMAKE_TEST_GENERATOR}
  1292. --build-project testf
  1293. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  1294. --build-two-config
  1295. --test-command testf)
  1296. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
  1297. ENDIF(CMAKE_Fortran_COMPILER_FULLPATH)
  1298. ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles"
  1299. OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
  1300. IF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode")
  1301. INCLUDE(FindJava)
  1302. IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
  1303. GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
  1304. FIND_FILE(JNI_H jni.h
  1305. "${JNIPATH}/../include"
  1306. "${JNIPATH}/../java/include")
  1307. IF(JNI_H)
  1308. FILE(READ "${JNI_H}" JNI_FILE)
  1309. IF("${JNI_FILE}" MATCHES "JDK1_2")
  1310. ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
  1311. --build-and-test
  1312. "${CMake_SOURCE_DIR}/Tests/Java"
  1313. "${CMake_BINARY_DIR}/Tests/Java"
  1314. --build-generator ${CMAKE_TEST_GENERATOR}
  1315. --build-project hello
  1316. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  1317. --build-two-config
  1318. --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
  1319. --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
  1320. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java")
  1321. ENDIF("${JNI_FILE}" MATCHES "JDK1_2")
  1322. ENDIF(JNI_H)
  1323. ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
  1324. ENDIF(NOT CMAKE_TEST_GENERATOR MATCHES "Xcode")
  1325. # add some cross compiler tests, for now only with makefile based generators
  1326. IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
  1327. # if sdcc is found, build the SimpleCOnly project with sdcc
  1328. FIND_PROGRAM(SDCC_EXECUTABLE sdcc)
  1329. MARK_AS_ADVANCED(SDCC_EXECUTABLE)
  1330. IF(SDCC_EXECUTABLE)
  1331. ADD_TEST(SimpleCOnly_sdcc ${CMAKE_CTEST_COMMAND}
  1332. --build-and-test
  1333. "${CMake_SOURCE_DIR}/Tests/SimpleCOnly"
  1334. "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc"
  1335. --build-generator ${CMAKE_TEST_GENERATOR}
  1336. --build-project SimpleC
  1337. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  1338. --build-options
  1339. "-DCMAKE_SYSTEM_NAME=Generic"
  1340. "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}")
  1341. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc")
  1342. ENDIF(SDCC_EXECUTABLE)
  1343. FIND_PROGRAM(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc)
  1344. FIND_PROGRAM(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++)
  1345. MARK_AS_ADVANCED(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE)
  1346. IF(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE)
  1347. ADD_TEST(Simple_Mingw_Linux2Win ${CMAKE_CTEST_COMMAND}
  1348. --build-and-test
  1349. "${CMake_SOURCE_DIR}/Tests/Simple"
  1350. "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win"
  1351. --build-generator ${CMAKE_TEST_GENERATOR}
  1352. --build-project Simple
  1353. --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
  1354. --build-options
  1355. "-DCMAKE_SYSTEM_NAME=Windows"
  1356. "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}"
  1357. "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}")
  1358. LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win")
  1359. ENDIF(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE)
  1360. ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
  1361. IF(UNIX)
  1362. STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix"
  1363. PREFIX_IS_FOR_TEST)
  1364. IF(PREFIX_IS_FOR_TEST)
  1365. CONFIGURE_FILE(
  1366. ${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in
  1367. ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh
  1368. @ONLY IMMEDIATE
  1369. )
  1370. ADD_TEST(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh)
  1371. ENDIF(PREFIX_IS_FOR_TEST)
  1372. ENDIF(UNIX)
  1373. IF(CMAKE_TEST_PLPLOT_DIR)
  1374. ADD_TEST(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake )
  1375. SET_TESTS_PROPERTIES ( plplot PROPERTIES TIMEOUT 5400)
  1376. ENDIF(CMAKE_TEST_PLPLOT_DIR)
  1377. IF(CMAKE_TEST_CHICKEN_DIR)
  1378. ADD_TEST(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake )
  1379. SET_TESTS_PROPERTIES ( Chicken PROPERTIES TIMEOUT 5400)
  1380. ENDIF(CMAKE_TEST_CHICKEN_DIR)
  1381. IF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
  1382. ADD_TEST(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake )
  1383. SET_TESTS_PROPERTIES ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
  1384. ENDIF(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
  1385. # If this is not an in-source build, provide a target to wipe out
  1386. # all the test build directories.
  1387. IF(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
  1388. CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in
  1389. ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY)
  1390. ADD_CUSTOM_TARGET(test_clean
  1391. COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake
  1392. COMMENT "Removing test build directories."
  1393. )
  1394. ENDIF(NOT EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt")
  1395. ADD_TEST(CMakeWizardTest ${CMAKE_CMAKE_COMMAND}
  1396. -D build_dir:STRING=${CMAKE_CURRENT_BINARY_DIR}/CMakeWizardTest
  1397. -D source_dir:STRING=${CMAKE_CURRENT_SOURCE_DIR}/Tutorial/Step3
  1398. -D CMAKE_CTEST_COMMAND:STRING=${CMAKE_CTEST_COMMAND}
  1399. -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeWizardTest.cmake)
  1400. ENDIF(BUILD_TESTING)
  1401. SUBDIRS(CMakeTests)