CMakeLists.txt 63 KB

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