CMakeLists.txt 132 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367
  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. string(REPLACE "." "/" dir "${NAME}")
  5. string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}")
  6. add_test(NAME "${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}"
  7. --build-and-test
  8. "${CMake_SOURCE_DIR}/Tests/${dir}"
  9. "${CMake_BINARY_DIR}/Tests/${dir}"
  10. --build-two-config
  11. ${build_generator_args}
  12. --build-project ${proj}
  13. ${${NAME}_CTEST_OPTIONS}
  14. --build-options ${build_options}
  15. ${${NAME}_BUILD_OPTIONS}
  16. --test-command ${COMMAND} ${ARGN})
  17. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
  18. endmacro()
  19. include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
  20. # Fake a user home directory to avoid polluting the real one.
  21. if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
  22. set(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
  23. file(MAKE_DIRECTORY "${TEST_HOME}")
  24. file(WRITE "${TEST_HOME}/.cvspass" ":pserver:[email protected]:/cvsroot/KWSys A\n")
  25. set(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one.
  26. # But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that
  27. # need access to the real HOME directory.
  28. set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\")
  29. set(ENV{HOME} \"${TEST_HOME}\")
  30. ")
  31. endif()
  32. # Choose a default configuration for CTest tests.
  33. set(CTestTest_CONFIG Debug)
  34. if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE)
  35. set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE})
  36. endif()
  37. configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
  38. ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
  39. # Testing
  40. if(BUILD_TESTING)
  41. set(CMake_TEST_DEVENV "")
  42. if(CMAKE_VS_DEVENV_COMMAND)
  43. set(CMake_TEST_DEVENV "${CMAKE_VS_DEVENV_COMMAND}")
  44. elseif(CMAKE_GENERATOR MATCHES "Visual Studio [7-9] " AND
  45. NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
  46. set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}")
  47. endif()
  48. if(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
  49. set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "")
  50. else()
  51. set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")
  52. endif()
  53. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  54. if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32))
  55. set(TEST_CompileCommandOutput 1)
  56. endif()
  57. endif()
  58. set(MAKE_IS_GNU )
  59. if(CMAKE_MAKE_PROGRAM MATCHES make)
  60. execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
  61. RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
  62. if("${res}" STREQUAL "0")
  63. if("${out}" MATCHES "GNU")
  64. set(MAKE_IS_GNU 1)
  65. endif()
  66. endif()
  67. endif()
  68. # some old versions of make simply cannot handle spaces in paths
  69. if (MAKE_IS_GNU OR
  70. CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR
  71. CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland")
  72. set(MAKE_SUPPORTS_SPACES 1)
  73. else()
  74. set(MAKE_SUPPORTS_SPACES 0)
  75. endif()
  76. # assume no resources building to test
  77. set(CMake_TEST_RESOURCES FALSE)
  78. # for windows and cygwin assume we have resources
  79. if(WIN32 OR CYGWIN)
  80. set(CMake_TEST_RESOURCES TRUE)
  81. endif()
  82. # for borland and watcom there is no resource support
  83. if(WATCOM OR BORLAND)
  84. set(CMake_TEST_RESOURCES FALSE)
  85. endif()
  86. set(build_generator_args
  87. --build-generator ${CMAKE_GENERATOR}
  88. )
  89. if(CMAKE_GENERATOR_PLATFORM)
  90. list(APPEND build_generator_args
  91. --build-generator-platform ${CMAKE_GENERATOR_PLATFORM}
  92. )
  93. endif()
  94. if(CMAKE_GENERATOR_TOOLSET)
  95. list(APPEND build_generator_args
  96. --build-generator-toolset ${CMAKE_GENERATOR_TOOLSET}
  97. )
  98. endif()
  99. set(build_options)
  100. if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
  101. list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
  102. endif()
  103. # Look for rpmbuild to use for tests.
  104. # The tool does not work with spaces in the path.
  105. if(NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
  106. find_program(RPMBUILD_EXECUTABLE NAMES rpmbuild)
  107. else()
  108. set(RPMBUILD_EXECUTABLE "RPMBUILD_EXECUTABLE-NOTFOUND")
  109. endif()
  110. if(RPMBUILD_EXECUTABLE)
  111. set(CPACK_BINARY_RPM ON)
  112. else()
  113. set(CPACK_BINARY_RPM OFF)
  114. endif()
  115. # Look for rpmbuild to use for tests.
  116. # The tool does not work with spaces in the path.
  117. find_program(DPKG_EXECUTABLE NAMES dpkg)
  118. if(DPKG_EXECUTABLE)
  119. set(CPACK_BINARY_DEB ON)
  120. else()
  121. set(CPACK_BINARY_DEB OFF)
  122. endif()
  123. #---------------------------------------------------------------------------
  124. # Add tests below here.
  125. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  126. add_subdirectory(CMakeLib)
  127. endif()
  128. add_subdirectory(CMakeOnly)
  129. add_subdirectory(RunCMake)
  130. add_subdirectory(FindPackageModeMakefileTest)
  131. # Collect a list of all test build directories.
  132. set(TEST_BUILD_DIRS)
  133. # Should the long tests be run?
  134. option(CMAKE_RUN_LONG_TESTS
  135. "Should the long tests be run (such as Bootstrap)." ON)
  136. mark_as_advanced(CMAKE_RUN_LONG_TESTS)
  137. if (CMAKE_RUN_LONG_TESTS)
  138. option(CTEST_TEST_CTEST
  139. "Should the tests that run a full sub ctest process be run?"
  140. OFF)
  141. mark_as_advanced(CTEST_TEST_CTEST)
  142. endif ()
  143. # Should tests that use CVS be run?
  144. #
  145. set(do_cvs_tests 0)
  146. if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  147. find_package(CVS QUIET)
  148. else()
  149. find_program(CVS_EXECUTABLE NAMES cvs)
  150. endif()
  151. if(CVS_EXECUTABLE)
  152. set(do_cvs_tests 1)
  153. endif()
  154. if(do_cvs_tests AND NOT UNIX)
  155. if("${CVS_EXECUTABLE}" MATCHES "cygwin")
  156. set(do_cvs_tests 0)
  157. endif()
  158. endif()
  159. # Should CPack tests be run? By default, yes, but...
  160. #
  161. # Disable packaging test on Apple 10.3 and below. PackageMaker starts
  162. # DiskManagementTool as root and disowns it
  163. # (http://lists.apple.com/archives/installer-dev/2005/Jul/msg00005.html).
  164. # It is left holding open pipe handles and preventing ProcessUNIX from
  165. # detecting end-of-data even after its immediate child exits. Then
  166. # the test hangs until it times out and is killed. This is a
  167. # well-known bug in kwsys process execution that I would love to get
  168. # time to fix.
  169. #
  170. option(CTEST_TEST_CPACK
  171. "Should the tests that use '--build-target package' be run?"
  172. ON)
  173. mark_as_advanced(CTEST_TEST_CPACK)
  174. set(CTEST_TEST_OSX_ARCH 0)
  175. set(CMake_TEST_XCODE_VERSION 0)
  176. if(APPLE)
  177. execute_process(
  178. COMMAND sw_vers -productVersion
  179. OUTPUT_VARIABLE OSX_VERSION
  180. OUTPUT_STRIP_TRAILING_WHITESPACE
  181. )
  182. if(OSX_VERSION VERSION_LESS 10.4)
  183. message(STATUS "Forcing CTEST_TEST_CPACK=OFF on OSX < 10.4")
  184. message(STATUS "OSX_VERSION='${OSX_VERSION}'")
  185. set(CTEST_TEST_CPACK OFF)
  186. else()
  187. set(CTEST_TEST_OSX_ARCH 1)
  188. endif()
  189. if(XCODE_VERSION)
  190. set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}")
  191. else()
  192. execute_process(
  193. COMMAND xcodebuild -version
  194. OUTPUT_VARIABLE _version ERROR_VARIABLE _version
  195. )
  196. if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
  197. set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
  198. endif()
  199. endif()
  200. if(CMAKE_OSX_SYSROOT)
  201. execute_process(
  202. COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version ProductName
  203. OUTPUT_VARIABLE _stdout
  204. OUTPUT_STRIP_TRAILING_WHITESPACE
  205. ERROR_VARIABLE _stderr
  206. RESULT_VARIABLE _failed
  207. )
  208. if(NOT _failed)
  209. set(CMAKE_OSX_SDKPRODUCT "${_stdout}")
  210. endif()
  211. execute_process(
  212. COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
  213. OUTPUT_VARIABLE _stdout
  214. OUTPUT_STRIP_TRAILING_WHITESPACE
  215. ERROR_VARIABLE _stderr
  216. RESULT_VARIABLE _failed
  217. )
  218. if(NOT _failed)
  219. set(CMAKE_OSX_SDKVERSION "${_stdout}")
  220. endif()
  221. endif()
  222. endif()
  223. # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value,
  224. # whichever is greater.
  225. set(CMAKE_LONG_TEST_TIMEOUT 1500)
  226. if(CTEST_TEST_TIMEOUT)
  227. set(CMAKE_LONG_TEST_TIMEOUT ${CTEST_TEST_TIMEOUT})
  228. endif()
  229. if(CMAKE_LONG_TEST_TIMEOUT LESS 1500)
  230. set(CMAKE_LONG_TEST_TIMEOUT 1500)
  231. endif()
  232. add_test(NAME CMake.Copyright
  233. COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCopyright.cmake)
  234. # add a bunch of standard build-and-test style tests
  235. ADD_TEST_MACRO(CommandLineTest CommandLineTest)
  236. ADD_TEST_MACRO(FindPackageTest FindPackageTest)
  237. ADD_TEST_MACRO(FindModulesExecuteAll FindModulesExecuteAll)
  238. ADD_TEST_MACRO(StringFileTest StringFileTest)
  239. ADD_TEST_MACRO(TryCompile TryCompile)
  240. ADD_TEST_MACRO(SystemInformation SystemInformation)
  241. ADD_TEST_MACRO(MathTest MathTest)
  242. ADD_TEST_MACRO(CompileFeatures CompileFeatures)
  243. ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
  244. if(CMake_TEST_RESOURCES)
  245. ADD_TEST_MACRO(VSResource VSResource)
  246. if (CMAKE_GENERATOR MATCHES "Ninja")
  247. add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP)
  248. endif ()
  249. endif()
  250. ADD_TEST_MACRO(MSManifest MSManifest)
  251. ADD_TEST_MACRO(Simple Simple)
  252. ADD_TEST_MACRO(PreOrder PreOrder)
  253. ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
  254. set_tests_properties(MissingSourceFile PROPERTIES
  255. PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
  256. if(CMake_TEST_XCODE_VERSION AND CMAKE_OSX_SDKVERSION AND CMAKE_OSX_SDKPRODUCT)
  257. if((NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1) AND
  258. ((NOT CMAKE_OSX_SDKPRODUCT STREQUAL "Mac OS X") OR
  259. (NOT CMAKE_OSX_SDKVERSION VERSION_LESS 10.10)))
  260. if(CMAKE_GENERATOR STREQUAL "Xcode")
  261. ADD_TEST_MACRO(SwiftMix SwiftMix)
  262. ADD_TEST_MACRO(SwiftOnly SwiftOnly)
  263. endif()
  264. endif()
  265. endif()
  266. if(CMAKE_Fortran_COMPILER)
  267. ADD_TEST_MACRO(FortranOnly FortranOnly)
  268. endif()
  269. # test Visual Studio GNU Fortran mixing with cmake_add_fortran_subdirectory
  270. # run this project if we have a working fortran compiler or
  271. # the test is enabled with CMAKE_TEST_CMAKE_ADD_FORTRAN cache variable.
  272. # If you enable the test, CMake should find the MinGW fortran install,
  273. # or in some cases you might need to set the PATH so that cmake can find
  274. # the gfortran from mingw.
  275. if(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN)
  276. set(CMAKE_SKIP_VSGNUFortran FALSE)
  277. # disable test for apple builds using ifort if they are building
  278. # more than one architecture, as ifort does not support that.
  279. if(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort))
  280. list(LENGTH CMAKE_OSX_ARCHITECTURES len)
  281. if("${len}" GREATER 1)
  282. message(STATUS "Skip VSGNUFortran for ifort dual cpu mac build")
  283. set(CMAKE_SKIP_VSGNUFortran TRUE)
  284. endif()
  285. endif()
  286. if((CMAKE_C_COMPILER MATCHES lsb)
  287. AND (CMAKE_Fortran_COMPILER MATCHES ifort))
  288. message(STATUS "Skip VSGNUFortran for ifort and lsb compilers")
  289. set(CMAKE_SKIP_VSGNUFortran TRUE)
  290. endif()
  291. if(NOT CMAKE_SKIP_VSGNUFortran)
  292. ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake)
  293. endif()
  294. endif()
  295. ADD_TEST_MACRO(COnly COnly)
  296. ADD_TEST_MACRO(CxxOnly CxxOnly)
  297. ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
  298. ADD_TEST_MACRO(IPO COnly/COnly)
  299. ADD_TEST_MACRO(OutDir runtime/OutDir)
  300. ADD_TEST_MACRO(ObjectLibrary UseCshared)
  301. ADD_TEST_MACRO(NewlineArgs NewlineArgs)
  302. ADD_TEST_MACRO(SetLang SetLang)
  303. ADD_TEST_MACRO(EmptyProperty EmptyProperty)
  304. ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
  305. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  306. ADD_TEST_MACRO(LoadCommand LoadedCommand)
  307. endif()
  308. ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory)
  309. ADD_TEST_MACRO(LinkLanguage LinkLanguage)
  310. ADD_TEST_MACRO(LinkLine LinkLine)
  311. ADD_TEST_MACRO(MacroTest miniMacroTest)
  312. ADD_TEST_MACRO(FunctionTest miniFunctionTest)
  313. ADD_TEST_MACRO(ReturnTest ReturnTest)
  314. ADD_TEST_MACRO(Properties Properties)
  315. ADD_TEST_MACRO(Assembler HelloAsm)
  316. ADD_TEST_MACRO(SourceGroups SourceGroups)
  317. ADD_TEST_MACRO(Preprocess Preprocess)
  318. set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
  319. ADD_TEST_MACRO(ExportImport ExportImport)
  320. ADD_TEST_MACRO(Unset Unset)
  321. ADD_TEST_MACRO(PolicyScope PolicyScope)
  322. ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
  323. ADD_TEST_MACRO(CompileDefinitions CompileDefinitions)
  324. ADD_TEST_MACRO(CompileOptions CompileOptions)
  325. ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
  326. ADD_TEST_MACRO(AliasTarget AliasTarget)
  327. ADD_TEST_MACRO(StagingPrefix StagingPrefix)
  328. ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
  329. if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
  330. set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
  331. ADD_TEST_MACRO(ConfigSources ConfigSources)
  332. endif()
  333. ADD_TEST_MACRO(SourcesProperty SourcesProperty)
  334. ADD_TEST_MACRO(SourceFileProperty SourceFileProperty)
  335. if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
  336. AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
  337. set(runCxxDialectTest 1)
  338. endif()
  339. if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
  340. AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
  341. if(NOT APPLE OR POLICY CMP0025)
  342. set(runCxxDialectTest 1)
  343. endif()
  344. endif()
  345. if(runCxxDialectTest)
  346. ADD_TEST_MACRO(CxxDialect CxxDialect)
  347. endif()
  348. set_tests_properties(EmptyLibrary PROPERTIES
  349. PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
  350. ADD_TEST_MACRO(CrossCompile CrossCompile)
  351. set_tests_properties(CrossCompile PROPERTIES
  352. PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode")
  353. if("${CMAKE_GENERATOR}" MATCHES "Make")
  354. ADD_TEST_MACRO(Policy0002 Policy0002)
  355. endif()
  356. if(CTEST_TEST_OSX_ARCH)
  357. ADD_TEST_MACRO(Architecture Architecture)
  358. set_tests_properties(Architecture PROPERTIES
  359. PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)")
  360. endif()
  361. list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
  362. if(NOT QT4_FOUND)
  363. find_package(Qt4 QUIET)
  364. endif()
  365. if(QT4_FOUND)
  366. # test whether the Qt4 which has been found works, on some machines
  367. # which run nightly builds there were errors like "wrong file format"
  368. # for libQtCore.so. So first check it works, and only if it does add
  369. # the automoc test.
  370. include(CheckCXXSourceCompiles)
  371. set(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
  372. set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
  373. set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
  374. set(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES})
  375. CHECK_CXX_SOURCE_COMPILES("#include <QCoreApplication>\n int main() {return (qApp == 0 ? 0 : 1); }\n"
  376. QT4_WORKS)
  377. set(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}")
  378. set(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}")
  379. endif()
  380. # run test for BundleUtilities on supported platforms/compilers
  381. if(MSVC OR
  382. MINGW OR
  383. CMAKE_SYSTEM_NAME MATCHES "Linux" OR
  384. CMAKE_SYSTEM_NAME MATCHES "Darwin")
  385. if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake")
  386. add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
  387. --build-and-test
  388. "${CMake_SOURCE_DIR}/Tests/BundleUtilities"
  389. "${CMake_BINARY_DIR}/Tests/BundleUtilities"
  390. ${build_generator_args}
  391. --build-project BundleUtilities
  392. --build-options ${build_options}
  393. )
  394. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities")
  395. # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities)
  396. # this test also depends on the existence of the standard qtiff plugin
  397. if(QT4_WORKS AND QT_QTSQL_FOUND)
  398. add_test(Qt4Deploy ${CMAKE_CTEST_COMMAND}
  399. --build-and-test
  400. "${CMake_SOURCE_DIR}/Tests/Qt4Deploy"
  401. "${CMake_BINARY_DIR}/Tests/Qt4Deploy"
  402. ${build_generator_args}
  403. --build-project Qt4Deploy
  404. --build-options ${build_options}
  405. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  406. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  407. )
  408. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy")
  409. endif()
  410. endif()
  411. endif()
  412. set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
  413. set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
  414. set(CMAKE_BUILD_TEST_EXE COnly)
  415. configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
  416. "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY)
  417. add_test(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P
  418. "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake")
  419. list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR})
  420. # now do it again for a project that has two project commands
  421. set(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject")
  422. set(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject")
  423. set(CMAKE_BUILD_TEST_EXE just_silly)
  424. configure_file("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"
  425. "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake" @ONLY)
  426. add_test(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P
  427. "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake")
  428. list(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR})
  429. ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize)
  430. add_test(Module.ExternalData ${CMAKE_CTEST_COMMAND}
  431. --build-and-test
  432. "${CMake_SOURCE_DIR}/Tests/Module/ExternalData"
  433. "${CMake_BINARY_DIR}/Tests/Module/ExternalData"
  434. ${build_generator_args}
  435. --build-project ExternalDataTest
  436. --build-noclean
  437. --force-new-ctest-process
  438. --build-options ${build_options}
  439. -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
  440. --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
  441. )
  442. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")
  443. ADD_TEST_MACRO(Module.FindDependency FindDependency)
  444. ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
  445. if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
  446. include(CheckCXXCompilerFlag)
  447. check_cxx_compiler_flag(-fPIE run_pic_test)
  448. else()
  449. if (CMAKE_CXX_COMPILER_ID MATCHES "PGI"
  450. OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
  451. OR CMAKE_SYSTEM_NAME MATCHES "IRIX64"
  452. OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
  453. set(run_pic_test 0)
  454. else()
  455. set(run_pic_test 1)
  456. endif()
  457. endif()
  458. if (run_pic_test)
  459. ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
  460. endif()
  461. if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND
  462. (NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2) AND
  463. (CMAKE_SYSTEM_NAME MATCHES "Linux"))
  464. include(CheckCXXCompilerFlag)
  465. check_cxx_compiler_flag(
  466. -fvisibility-inlines-hidden run_inlines_hidden_test)
  467. endif()
  468. if(run_inlines_hidden_test)
  469. add_test(Visibility ${CMAKE_CTEST_COMMAND}
  470. --build-and-test
  471. "${CMake_SOURCE_DIR}/Tests/Visibility"
  472. "${CMake_BINARY_DIR}/Tests/Visibility"
  473. ${build_generator_args}
  474. --build-project Visibility
  475. --build-options ${build_options}
  476. )
  477. list(APPEND TEST_BUILD_DIRS
  478. "${CMake_BINARY_DIR}/Tests/Visibility"
  479. )
  480. endif()
  481. add_test(LinkFlags-prepare
  482. ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  483. --build-and-test
  484. "${CMake_SOURCE_DIR}/Tests/LinkFlags"
  485. "${CMake_BINARY_DIR}/Tests/LinkFlags"
  486. ${build_generator_args}
  487. --build-project LinkFlags
  488. --build-target LinkFlags
  489. --build-options ${build_options}
  490. -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE}
  491. )
  492. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags")
  493. macro(ADD_LINK_FLAGS_TEST name depends)
  494. add_test(LinkFlags-${name}
  495. ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags"
  496. --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE}
  497. )
  498. set_tests_properties(LinkFlags-${name} PROPERTIES
  499. PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends})
  500. endmacro()
  501. ADD_LINK_FLAGS_TEST(lib prepare)
  502. ADD_LINK_FLAGS_TEST(dll lib)
  503. ADD_LINK_FLAGS_TEST(mod dll)
  504. ADD_LINK_FLAGS_TEST(exe mod)
  505. ADD_LINK_FLAGS_TEST(lib_config exe)
  506. ADD_LINK_FLAGS_TEST(dll_config lib_config)
  507. ADD_LINK_FLAGS_TEST(mod_config dll_config)
  508. ADD_LINK_FLAGS_TEST(exe_config mod_config)
  509. ADD_LINK_FLAGS_TEST(lib_flags exe_config)
  510. ADD_LINK_FLAGS_TEST(dll_flags lib_flags)
  511. ADD_LINK_FLAGS_TEST(mod_flags dll_flags)
  512. ADD_LINK_FLAGS_TEST(exe_flags mod_flags)
  513. ADD_LINK_FLAGS_TEST(lib_flags_config exe_flags)
  514. ADD_LINK_FLAGS_TEST(dll_flags_config lib_flags_config)
  515. ADD_LINK_FLAGS_TEST(mod_flags_config dll_flags_config)
  516. ADD_LINK_FLAGS_TEST(exe_flags_config mod_flags_config)
  517. # If we are running right now with a Unix Makefiles or Ninja based generator,
  518. # build the "Simple" test with the ExtraGenerators, if available
  519. # This doesn't test whether the generated project files work (unfortunately),
  520. # mainly it tests that cmake doesn't crash when generating these project files.
  521. if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "Ninja")
  522. # check which generators we have
  523. execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
  524. OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
  525. set(extraGenerators
  526. "CodeBlocks"
  527. "CodeLite"
  528. "Eclipse CDT4"
  529. "Kate"
  530. "KDevelop3"
  531. "Sublime Text 2")
  532. foreach(extraGenerator ${extraGenerators})
  533. if ("${cmakeOutput}" MATCHES "${extraGenerator} - ${CMAKE_GENERATOR}")
  534. set(extraGeneratorTestName "Simple_${extraGenerator}Generator")
  535. string(REPLACE " " "" extraGeneratorTestName ${extraGeneratorTestName})
  536. add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
  537. --build-and-test
  538. "${CMake_SOURCE_DIR}/Tests/Simple"
  539. "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
  540. --build-two-config
  541. --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
  542. --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
  543. --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
  544. --build-project Simple
  545. --build-options ${build_options}
  546. --test-command Simple)
  547. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
  548. endif ()
  549. endforeach(extraGenerator)
  550. endif()
  551. # test for correct sub-project generation
  552. # not implemented in VS 7.0, Xcode, or Ninja
  553. if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 7$|Xcode|Ninja")
  554. # run cmake and configure all of SubProject
  555. # but only build the independent executable car
  556. add_test(SubProject ${CMAKE_CTEST_COMMAND}
  557. --build-and-test
  558. "${CMake_SOURCE_DIR}/Tests/SubProject"
  559. "${CMake_BINARY_DIR}/Tests/SubProject"
  560. --build-project SubProject
  561. ${build_generator_args}
  562. --build-target car
  563. --build-options ${build_options}
  564. --test-command car
  565. )
  566. # For stage 2, do not run cmake again.
  567. # Then build the foo sub project which should build
  568. # the bar library which should be referenced because
  569. # foo links to the static library bar, but bar is not
  570. # directly in the foo sub project
  571. if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
  572. set(SubProject-Stage2_BUILD_MAKEPROGRAM
  573. --build-makeprogram ${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
  574. )
  575. endif()
  576. add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND}
  577. --build-and-test
  578. "${CMake_SOURCE_DIR}/Tests/SubProject/foo"
  579. "${CMake_BINARY_DIR}/Tests/SubProject/foo"
  580. --build-generator ${CMAKE_GENERATOR}
  581. --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
  582. --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
  583. ${SubProject-Stage2_BUILD_MAKEPROGRAM}
  584. --build-nocmake
  585. --build-project foo
  586. --build-target foo
  587. --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo"
  588. --build-options ${build_options}
  589. --test-command foo
  590. )
  591. set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject)
  592. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject")
  593. endif()
  594. # macro to add a test that will build a nightly release
  595. # of CMake for given platform using the release scripts
  596. macro(ADD_NIGHTLY_BUILD_TEST name script)
  597. set(_TEST_DIR "${CMake_BINARY_DIR}/Tests/${name}")
  598. file(MAKE_DIRECTORY "${_TEST_DIR}")
  599. file(WRITE "${_TEST_DIR}/nightly-cmake.sh"
  600. "cd ${_TEST_DIR}
  601. ${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=nightly -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
  602. ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
  603. ")
  604. add_test(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
  605. if(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
  606. set_tests_properties (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  607. endif()
  608. endmacro()
  609. if(CMAKE_BUILD_NIGHTLY_RELEASES)
  610. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin32
  611. win32_release.cmake)
  612. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWin64
  613. win64_release.cmake)
  614. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX
  615. osx_release.cmake)
  616. ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux64
  617. linux64_release.cmake)
  618. set_property(TEST CMakeNightlyWin64 PROPERTY DEPENDS CMakeNightlyWin32)
  619. endif()
  620. # add tests with more complex invocations
  621. add_test(Framework ${CMAKE_CTEST_COMMAND}
  622. --build-and-test
  623. "${CMake_SOURCE_DIR}/Tests/Framework"
  624. "${CMake_BINARY_DIR}/Tests/Framework"
  625. --build-two-config
  626. ${build_generator_args}
  627. --build-project Framework
  628. --build-options ${build_options}
  629. "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/Framework/Install"
  630. --test-command bar)
  631. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Framework")
  632. add_test(TargetName ${CMAKE_CTEST_COMMAND}
  633. --build-and-test
  634. "${CMake_SOURCE_DIR}/Tests/TargetName"
  635. "${CMake_BINARY_DIR}/Tests/TargetName"
  636. --build-two-config
  637. ${build_generator_args}
  638. --build-project TargetName
  639. --build-options ${build_options}
  640. --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
  641. ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
  642. ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
  643. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName")
  644. add_test(LibName ${CMAKE_CTEST_COMMAND}
  645. --build-and-test
  646. "${CMake_SOURCE_DIR}/Tests/LibName"
  647. "${CMake_BINARY_DIR}/Tests/LibName"
  648. --build-two-config
  649. ${build_generator_args}
  650. --build-project LibName
  651. --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
  652. --build-options ${build_options}
  653. --test-command foobar
  654. )
  655. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LibName")
  656. add_test(CustComDepend ${CMAKE_CTEST_COMMAND}
  657. --build-and-test
  658. "${CMake_SOURCE_DIR}/Tests/CustComDepend"
  659. "${CMake_BINARY_DIR}/Tests/CustComDepend"
  660. --build-two-config
  661. ${build_generator_args}
  662. --build-project CustComDepend
  663. --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
  664. --build-options ${build_options}
  665. --test-command foo bar.c
  666. )
  667. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustComDepend")
  668. add_test(ArgumentExpansion ${CMAKE_CTEST_COMMAND}
  669. --build-and-test
  670. "${CMake_SOURCE_DIR}/Tests/ArgumentExpansion"
  671. "${CMake_BINARY_DIR}/Tests/ArgumentExpansion"
  672. ${build_generator_args}
  673. --build-project ArgumentExpansion
  674. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ArgumentExpansion/bin"
  675. --build-options ${build_options}
  676. )
  677. set_tests_properties(ArgumentExpansion PROPERTIES
  678. FAIL_REGULAR_EXPRESSION "Unexpected: ")
  679. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion")
  680. add_test(GeneratorExpression
  681. ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  682. --build-and-test
  683. "${CMake_SOURCE_DIR}/Tests/GeneratorExpression"
  684. "${CMake_BINARY_DIR}/Tests/GeneratorExpression"
  685. ${build_generator_args}
  686. --build-project GeneratorExpression
  687. --build-options ${build_options}
  688. -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
  689. --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
  690. )
  691. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")
  692. add_test(CustomCommand ${CMAKE_CTEST_COMMAND}
  693. --build-and-test
  694. "${CMake_SOURCE_DIR}/Tests/CustomCommand"
  695. "${CMake_BINARY_DIR}/Tests/CustomCommand"
  696. --build-two-config
  697. ${build_generator_args}
  698. --build-project CustomCommand
  699. --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
  700. --build-options ${build_options}
  701. --test-command CustomCommand
  702. )
  703. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
  704. ADD_TEST_MACRO(CustomCommandByproducts CustomCommandByproducts)
  705. ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND})
  706. add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND}
  707. --build-and-test
  708. "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory"
  709. "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory"
  710. --build-two-config
  711. ${build_generator_args}
  712. --build-project TestWorkingDir
  713. --build-options ${build_options}
  714. --test-command working
  715. )
  716. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommandWorkingDirectory")
  717. #add_test(SimpleExclude ${CMAKE_CTEST_COMMAND}
  718. # --build-and-test
  719. # "${CMake_SOURCE_DIR}/Tests/SimpleExclude"
  720. # "${CMake_BINARY_DIR}/Tests/SimpleExclude"
  721. # ${build_generator_args}
  722. # --build-project SimpleExclude
  723. # --build-two-config
  724. # --build-options ${build_options}
  725. # --test-command t4
  726. #--test-command "${CMAKE_COMMAND}"
  727. #"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
  728. #-P "${CMake_BINARY_DIR}/Tests/SimpleExclude/run.cmake"
  729. #)
  730. # add_test(SameName ${CMAKE_CTEST_COMMAND}
  731. # --build-and-test
  732. # "${CMake_SOURCE_DIR}/Tests/SameName"
  733. # "${CMake_BINARY_DIR}/Tests/SameName"
  734. # ${build_generator_args}
  735. # --build-project SameName
  736. # --build-two-config
  737. # --build-options ${build_options}
  738. # --test-command
  739. # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2")
  740. add_test(OutOfSource ${CMAKE_CTEST_COMMAND}
  741. --build-and-test
  742. "${CMake_SOURCE_DIR}/Tests/OutOfSource"
  743. "${CMake_BINARY_DIR}/Tests/OutOfSource"
  744. ${build_generator_args}
  745. --build-project OutOfSource
  746. --build-two-config
  747. --build-options ${build_options}
  748. --test-command
  749. "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple")
  750. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSource")
  751. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfSourceDeep")
  752. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/OutOfBinary")
  753. add_test(BuildDepends ${CMAKE_CTEST_COMMAND}
  754. --build-and-test
  755. "${CMake_SOURCE_DIR}/Tests/BuildDepends"
  756. "${CMake_BINARY_DIR}/Tests/BuildDepends"
  757. ${build_generator_args}
  758. --build-project BuildDepends
  759. --build-options ${build_options}
  760. )
  761. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
  762. set(SimpleInstallInstallDir
  763. "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
  764. add_test(SimpleInstall ${CMAKE_CTEST_COMMAND}
  765. --build-and-test
  766. "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
  767. "${CMake_BINARY_DIR}/Tests/SimpleInstall"
  768. ${build_generator_args}
  769. --build-project TestSimpleInstall
  770. --build-two-config
  771. --build-options ${build_options}
  772. "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
  773. "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}"
  774. --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
  775. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
  776. add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
  777. --build-and-test
  778. "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
  779. "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
  780. ${build_generator_args}
  781. --build-project TestSimpleInstall
  782. --build-two-config
  783. --build-options ${build_options}
  784. "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
  785. "-DSTAGE2:BOOL=1"
  786. --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
  787. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
  788. set(MissingInstallInstallDir
  789. "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory")
  790. add_test(MissingInstall ${CMAKE_CTEST_COMMAND}
  791. --build-and-test
  792. "${CMake_SOURCE_DIR}/Tests/MissingInstall"
  793. "${CMake_BINARY_DIR}/Tests/MissingInstall"
  794. ${build_generator_args}
  795. --build-project TestMissingInstall
  796. --build-two-config
  797. --build-options ${build_options}
  798. "-DCMAKE_INSTALL_PREFIX:PATH=${MissingInstallInstallDir}")
  799. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MissingInstall")
  800. # By default, run the CPackComponents test if the CTEST_TEST_CPACK
  801. # option is ON:
  802. #
  803. set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
  804. set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
  805. set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
  806. set(CTEST_RUN_CPackComponentsPrefix ${CTEST_TEST_CPACK})
  807. find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
  808. PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
  809. DOC "makensis program location"
  810. )
  811. # But on Windows, only run the CPackComponents test if the NSIS
  812. # installer builder is available:
  813. #
  814. if(WIN32)
  815. if(NSIS_MAKENSIS_EXECUTABLE)
  816. set(CTEST_RUN_CPackComponents ON)
  817. else()
  818. set(CTEST_RUN_CPackComponents OFF)
  819. set(CTEST_package_X11_TEST OFF)
  820. endif()
  821. endif()
  822. # On Windows run the CPackWiXGenerator test
  823. # if the WiX Toolset seems to be available
  824. if(WIN32)
  825. file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT)
  826. find_program(WIX_LIGHT_EXECUTABLE light
  827. PATHS "${WIX_ROOT}/bin"
  828. DOC "WiX Toolset light.exe location")
  829. if(WIX_LIGHT_EXECUTABLE)
  830. add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND}
  831. -C \${CTEST_CONFIGURATION_TYPE}
  832. --build-and-test
  833. "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator"
  834. "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
  835. ${build_generator_args}
  836. --build-project CPackWiXGenerator
  837. --build-options ${build_options}
  838. --test-command ${CMAKE_CMAKE_COMMAND}
  839. "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
  840. "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
  841. -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
  842. set_property(TEST CPackWiXGenerator PROPERTY
  843. ATTACHED_FILES_ON_FAIL
  844. "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator/_CPack_Packages/win32/WIX/wix.log")
  845. endif()
  846. endif()
  847. if(CTEST_RUN_CPackComponents)
  848. set(CPackComponents_BUILD_OPTIONS)
  849. if(APPLE)
  850. set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
  851. if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6")
  852. set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
  853. -DCPACK_BINARY_PRODUCTBUILD:BOOL=ON)
  854. endif()
  855. endif()
  856. if(NSIS_MAKENSIS_EXECUTABLE)
  857. set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
  858. -DCPACK_BINARY_NSIS:BOOL=ON)
  859. endif()
  860. add_test(CPackComponents ${CMAKE_CTEST_COMMAND}
  861. --build-and-test
  862. "${CMake_SOURCE_DIR}/Tests/CPackComponents"
  863. "${CMake_BINARY_DIR}/Tests/CPackComponents"
  864. ${build_generator_args}
  865. --build-project CPackComponents
  866. --build-two-config
  867. --build-target package
  868. --build-options ${build_options}
  869. -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
  870. -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
  871. ${CPackComponents_BUILD_OPTIONS}
  872. --graphviz=CPackComponents.dot
  873. --test-command ${CMAKE_CMAKE_COMMAND}
  874. "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
  875. -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
  876. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
  877. endif()
  878. if(CTEST_RUN_CPackComponentsForAll)
  879. # Check whether if rpmbuild command is found
  880. # before adding RPM tests
  881. if(CPACK_BINARY_RPM)
  882. list(APPEND ACTIVE_CPACK_GENERATORS RPM)
  883. endif()
  884. # Check whether if dpkg command is found
  885. # before adding DEB tests
  886. if(CPACK_BINARY_DEB)
  887. list(APPEND ACTIVE_CPACK_GENERATORS DEB)
  888. endif()
  889. # ACTIVE_CPACK_GENERATORS variable
  890. # now contains the list of 'active generators'
  891. set(CPackComponentsForAll_BUILD_OPTIONS)
  892. # set up list of CPack generators
  893. list(APPEND ACTIVE_CPACK_GENERATORS "ZIP")
  894. if(APPLE)
  895. list(APPEND ACTIVE_CPACK_GENERATORS "DragNDrop")
  896. if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6")
  897. list(APPEND ACTIVE_CPACK_GENERATORS "productbuild")
  898. endif()
  899. endif()
  900. # set up list of component packaging ways
  901. list(APPEND CWAYLST "default")
  902. list(APPEND CWAYLST "OnePackPerGroup")
  903. list(APPEND CWAYLST "IgnoreGroup")
  904. list(APPEND CWAYLST "AllInOne")
  905. foreach(CPackGen IN LISTS ACTIVE_CPACK_GENERATORS)
  906. set(CPackRun_CPackGen "-DCPackGen=${CPackGen}")
  907. foreach(CPackComponentWay ${CWAYLST})
  908. set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}")
  909. add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay}
  910. ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  911. --build-and-test
  912. "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
  913. "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
  914. ${build_generator_args}
  915. --build-project CPackComponentsForAll
  916. --build-options ${build_options}
  917. -DCPACK_GENERATOR:STRING=${CPackGen}
  918. -DCPACK_BINARY_${CPackGen}:BOOL=ON
  919. ${CPackRun_CPackComponentWay}
  920. ${CPackComponentsForAll_BUILD_OPTIONS}
  921. --graphviz=CPackComponentsForAll.dot
  922. --test-command ${CMAKE_CMAKE_COMMAND}
  923. "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
  924. "${CPackRun_CPackGen}"
  925. "${CPackRun_CPackComponentWay}"
  926. -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
  927. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}")
  928. endforeach()
  929. endforeach()
  930. # debian specific
  931. if(DPKG_EXECUTABLE)
  932. unset(CPackRun_CPackDEBConfiguration_ALL_CONFIGS)
  933. set(DEB_TEST_NAMES "CPackComponentsDEB")
  934. set(DEB_CONFIGURATIONS_TO_TEST "components-lintian-dpkgdeb-checks"
  935. "components-description1"
  936. "components-description2"
  937. "components-source"
  938. "components-shlibdeps1"
  939. "components-depend1"
  940. "components-depend2"
  941. "compression")
  942. set(CPackGen "DEB")
  943. set(CPackRun_CPackGen "-DCPackGen=${CPackGen}")
  944. foreach(CPackDEBConfiguration IN LISTS DEB_CONFIGURATIONS_TO_TEST)
  945. set(CPackRun_CPackDEBConfiguration "-DCPackDEBConfiguration=${CPackDEBConfiguration}")
  946. add_test(${DEB_TEST_NAMES}-${CPackDEBConfiguration}
  947. ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  948. --build-and-test
  949. "${CMake_SOURCE_DIR}/Tests/${DEB_TEST_NAMES}"
  950. "${CMake_BINARY_DIR}/Tests/${DEB_TEST_NAMES}/build${CPackGen}-${CPackDEBConfiguration}"
  951. ${build_generator_args}
  952. --build-project CPackComponentsDEB
  953. --build-options ${build_options}
  954. -DCPACK_GENERATOR:STRING=${CPackGen}
  955. -DCPACK_BINARY_${CPackGen}:BOOL=ON
  956. ${CPackRun_CPackDEBConfiguration}
  957. ${CPackRun_CPackDEBConfiguration_ALL_CONFIGS}
  958. --graphviz=${DEB_TEST_NAMES}.dot
  959. --test-command ${CMAKE_CMAKE_COMMAND}
  960. "-D${DEB_TEST_NAMES}_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/${DEB_TEST_NAMES}"
  961. "-D${DEB_TEST_NAMES}_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/${DEB_TEST_NAMES}/build${CPackGen}-${CPackDEBConfiguration}"
  962. "${CPackRun_CPackGen}"
  963. "${CPackRun_CPackDEBConfiguration}"
  964. -P "${CMake_SOURCE_DIR}/Tests/${DEB_TEST_NAMES}/RunCPackVerifyResult-${CPackDEBConfiguration}.cmake")
  965. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${DEB_TEST_NAMES}/build${CPackGen}-${CPackDEBConfiguration}")
  966. endforeach()
  967. endif()
  968. endif()
  969. # By default, turn this test off (because it takes a long time...)
  970. #
  971. if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
  972. set(CTEST_RUN_CPackTestAllGenerators OFF)
  973. # ...but: if it appears to be a coverage dashboard, or long tests are
  974. # on, then set it to the generic CTEST_TEST_CPACK setting.
  975. #
  976. if(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR
  977. NOT "$ENV{COVFILE}" STREQUAL "" OR
  978. CMAKE_RUN_LONG_TESTS)
  979. set(CTEST_RUN_CPackTestAllGenerators ${CTEST_TEST_CPACK})
  980. endif()
  981. endif()
  982. if(CTEST_RUN_CPackTestAllGenerators)
  983. add_test(CPackTestAllGenerators ${CMAKE_CTEST_COMMAND}
  984. --build-and-test
  985. "${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators"
  986. "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators"
  987. ${build_generator_args}
  988. --build-project CPackTestAllGenerators
  989. --build-options ${build_options}
  990. --test-command
  991. ${CMAKE_CMAKE_COMMAND}
  992. -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators
  993. -P ${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators/RunCPack.cmake
  994. )
  995. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators")
  996. endif()
  997. if(CTEST_RUN_CPackComponentsPrefix)
  998. set(CPackComponents_BUILD_OPTIONS)
  999. if(APPLE)
  1000. set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
  1001. if(CMake_TEST_XCODE_VERSION VERSION_GREATER "4.6")
  1002. set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
  1003. -DCPACK_BINARY_PRODUCTBUILD:BOOL=ON)
  1004. endif()
  1005. endif()
  1006. if(NOT NSIS_MAKENSIS_EXECUTABLE)
  1007. set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
  1008. -DCPACK_BINARY_NSIS:BOOL=OFF)
  1009. endif()
  1010. add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND}
  1011. --build-and-test
  1012. "${CMake_SOURCE_DIR}/Tests/CPackComponentsPrefix"
  1013. "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix"
  1014. ${build_generator_args}
  1015. --build-project CPackComponentsPrefix
  1016. --build-two-config
  1017. --build-target package
  1018. --build-options ${build_options}
  1019. -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
  1020. -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
  1021. -DCPACK_BINARY_ZIP:BOOL=ON
  1022. ${CPackComponents_BUILD_OPTIONS}
  1023. )
  1024. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix")
  1025. endif()
  1026. if(CTEST_package_X11_TEST)
  1027. set(X11_build_target_arg --build-target package)
  1028. else()
  1029. set(X11_build_target_arg)
  1030. endif()
  1031. add_test(X11 ${CMAKE_CTEST_COMMAND}
  1032. --build-and-test
  1033. "${CMake_SOURCE_DIR}/Tests/X11"
  1034. "${CMake_BINARY_DIR}/Tests/X11"
  1035. ${build_generator_args}
  1036. --build-project UseX11
  1037. --build-two-config
  1038. ${X11_build_target_arg}
  1039. --build-options ${build_options}
  1040. --test-command UseX11)
  1041. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11")
  1042. if(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators)
  1043. set(CTEST_RUN_CMakeTestAllGenerators ON)
  1044. endif()
  1045. if(CTEST_RUN_CMakeTestAllGenerators)
  1046. add_test(CMakeTestAllGenerators ${CMAKE_CMAKE_COMMAND}
  1047. -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators
  1048. -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
  1049. -P ${CMake_SOURCE_DIR}/Tests/CMakeTestAllGenerators/RunCMake.cmake
  1050. )
  1051. list(APPEND TEST_BUILD_DIRS
  1052. "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators")
  1053. endif()
  1054. if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
  1055. set(CTEST_RUN_CMakeTestMultipleConfigures ON)
  1056. endif()
  1057. if(CTEST_RUN_CMakeTestMultipleConfigures)
  1058. add_test(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND}
  1059. -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures
  1060. -D gen=${CMAKE_GENERATOR}
  1061. -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
  1062. -P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
  1063. )
  1064. list(APPEND TEST_BUILD_DIRS
  1065. "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures")
  1066. endif()
  1067. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  1068. add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
  1069. --build-and-test
  1070. "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
  1071. "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
  1072. ${build_generator_args}
  1073. --build-project LoadCommand
  1074. --build-options ${build_options}
  1075. --test-command LoadedCommand
  1076. )
  1077. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
  1078. endif()
  1079. add_test(complex ${CMAKE_CTEST_COMMAND}
  1080. --build-and-test
  1081. "${CMake_SOURCE_DIR}/Tests/Complex"
  1082. "${CMake_BINARY_DIR}/Tests/Complex"
  1083. --build-two-config
  1084. --build-config-sample "${CMAKE_CTEST_COMMAND}"
  1085. ${build_generator_args}
  1086. --build-project Complex
  1087. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
  1088. --build-options ${build_options}
  1089. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  1090. --test-command complex
  1091. )
  1092. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex")
  1093. add_test(complexOneConfig ${CMAKE_CTEST_COMMAND}
  1094. --build-and-test
  1095. "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
  1096. "${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
  1097. ${build_generator_args}
  1098. --build-project Complex
  1099. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
  1100. --build-options ${build_options}
  1101. -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  1102. --test-command complex)
  1103. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig")
  1104. # because of the registry write these tests depend on each other
  1105. set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig)
  1106. add_test(Environment ${CMAKE_CTEST_COMMAND}
  1107. --build-and-test
  1108. "${CMake_SOURCE_DIR}/Tests/Environment"
  1109. "${CMake_BINARY_DIR}/Tests/Environment"
  1110. ${build_generator_args}
  1111. --build-project EnvironmentProj
  1112. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Environment"
  1113. --force-new-ctest-process
  1114. --build-options ${build_options}
  1115. --test-command ${CMAKE_CTEST_COMMAND} -V
  1116. )
  1117. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
  1118. add_test(QtAutomocNoQt ${CMAKE_CTEST_COMMAND}
  1119. --build-and-test
  1120. "${CMake_SOURCE_DIR}/Tests/QtAutomocNoQt"
  1121. "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt"
  1122. ${build_generator_args}
  1123. --build-project QtAutomocNoQt
  1124. --build-options ${build_options}
  1125. -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
  1126. )
  1127. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
  1128. # On Windows there is no RPATH, so while Qt might be available for building,
  1129. # the required dlls may not be in the PATH, so we can't run the executables
  1130. # on that platform.
  1131. if(WIN32)
  1132. set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V)
  1133. set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V)
  1134. else()
  1135. set(run_autogen_test complex/QtAutogen)
  1136. set(run_autouic_test QtAutoUicInterface)
  1137. endif()
  1138. if(NOT CMAKE_CONFIGURATION_TYPES)
  1139. set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>)
  1140. endif()
  1141. find_package(Qt5Widgets QUIET NO_MODULE)
  1142. if(Qt5Widgets_FOUND)
  1143. add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND}
  1144. --build-and-test
  1145. "${CMake_SOURCE_DIR}/Tests/QtAutogen"
  1146. "${CMake_BINARY_DIR}/Tests/Qt5Autogen"
  1147. ${build_generator_args}
  1148. --build-project QtAutogen
  1149. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen"
  1150. --force-new-ctest-process
  1151. --build-options ${build_options}
  1152. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
  1153. ${QtAutogen_BUILD_OPTIONS}
  1154. --test-command ${run_autogen_test}
  1155. )
  1156. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen")
  1157. add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND}
  1158. --build-and-test
  1159. "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface"
  1160. "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface"
  1161. ${build_generator_args}
  1162. --build-project QtAutoUicInterface
  1163. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface"
  1164. --force-new-ctest-process
  1165. --build-options ${build_options}
  1166. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
  1167. --test-command ${run_autouic_test}
  1168. )
  1169. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface")
  1170. endif()
  1171. if(QT4_WORKS AND QT_QTGUI_FOUND)
  1172. add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND}
  1173. --build-and-test
  1174. "${CMake_SOURCE_DIR}/Tests/QtAutogen"
  1175. "${CMake_BINARY_DIR}/Tests/Qt4Autogen"
  1176. ${build_generator_args}
  1177. --build-project QtAutogen
  1178. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen"
  1179. --force-new-ctest-process
  1180. --build-options ${build_options}
  1181. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
  1182. ${QtAutogen_BUILD_OPTIONS}
  1183. --test-command ${run_autogen_test}
  1184. )
  1185. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen")
  1186. add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND}
  1187. --build-and-test
  1188. "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface"
  1189. "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface"
  1190. ${build_generator_args}
  1191. --build-project QtAutoUicInterface
  1192. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface"
  1193. --force-new-ctest-process
  1194. --build-options ${build_options}
  1195. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
  1196. --test-command ${run_autouic_test}
  1197. )
  1198. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface")
  1199. add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
  1200. --build-and-test
  1201. "${CMake_SOURCE_DIR}/Tests/Qt4Targets"
  1202. "${CMake_BINARY_DIR}/Tests/Qt4Targets"
  1203. ${build_generator_args}
  1204. --build-project Qt4Targets
  1205. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets"
  1206. --force-new-ctest-process
  1207. --build-options ${build_options}
  1208. -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
  1209. --test-command ${CMAKE_CTEST_COMMAND} -V
  1210. )
  1211. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets")
  1212. if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0)
  1213. add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND}
  1214. --build-and-test
  1215. "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc"
  1216. "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
  1217. ${build_generator_args}
  1218. --build-project Qt4And5Automoc
  1219. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
  1220. --force-new-ctest-process
  1221. --build-options ${build_options}
  1222. --test-command ${CMAKE_CTEST_COMMAND} -V
  1223. )
  1224. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc")
  1225. add_test(Qt4And5AutomocReverse ${CMAKE_CTEST_COMMAND}
  1226. --build-and-test
  1227. "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc"
  1228. "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocReverse"
  1229. ${build_generator_args}
  1230. --build-project Qt4And5Automoc
  1231. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocReverse"
  1232. --force-new-ctest-process
  1233. --build-options ${build_options} -DQT_REVERSE_FIND_ORDER=1
  1234. --test-command ${CMAKE_CTEST_COMMAND} -V
  1235. )
  1236. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocReverse")
  1237. endif()
  1238. endif()
  1239. if(CMake_TEST_CUDA)
  1240. add_subdirectory(Cuda)
  1241. add_subdirectory(CudaOnly)
  1242. endif()
  1243. if(CMake_TEST_FindBoost)
  1244. add_subdirectory(FindBoost)
  1245. endif()
  1246. if(CMake_TEST_FindBZip2)
  1247. add_subdirectory(FindBZip2)
  1248. endif()
  1249. if(CMake_TEST_FindGSL)
  1250. add_subdirectory(FindGSL)
  1251. endif()
  1252. if(CMake_TEST_FindGTest)
  1253. add_subdirectory(FindGTest)
  1254. endif()
  1255. if(CMake_TEST_FindICU)
  1256. add_subdirectory(FindICU)
  1257. endif()
  1258. if(CMake_TEST_FindJsonCpp)
  1259. add_subdirectory(FindJsonCpp)
  1260. endif()
  1261. if(CMake_TEST_FindLibRHash)
  1262. add_subdirectory(FindLibRHash)
  1263. endif()
  1264. if(CMake_TEST_FindLibUV)
  1265. add_subdirectory(FindLibUV)
  1266. endif()
  1267. if(CMake_TEST_FindLTTngUST)
  1268. add_subdirectory(FindLTTngUST)
  1269. endif()
  1270. if(CMake_TEST_FindOpenCL)
  1271. add_subdirectory(FindOpenCL)
  1272. endif()
  1273. if(CMake_TEST_FindOpenGL)
  1274. add_subdirectory(FindOpenGL)
  1275. endif()
  1276. if(CMake_TEST_FindOpenSSL)
  1277. add_subdirectory(FindOpenSSL)
  1278. endif()
  1279. if(CMake_TEST_FindPNG)
  1280. add_subdirectory(FindPNG)
  1281. endif()
  1282. if(CMake_TEST_FindTIFF)
  1283. add_subdirectory(FindTIFF)
  1284. endif()
  1285. if(CMake_TEST_FindVulkan)
  1286. add_subdirectory(FindVulkan)
  1287. endif()
  1288. if(CMake_TEST_FindXalanC)
  1289. add_subdirectory(FindXalanC)
  1290. endif()
  1291. if(CMake_TEST_FindXercesC)
  1292. add_subdirectory(FindXercesC)
  1293. endif()
  1294. add_subdirectory(FindThreads)
  1295. # Matlab module
  1296. if(CMake_TEST_FindMatlab)
  1297. ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
  1298. ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
  1299. ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
  1300. endif()
  1301. find_package(GTK2 QUIET)
  1302. if(GTK2_FOUND)
  1303. add_subdirectory(FindGTK2)
  1304. endif()
  1305. add_test(ExternalProject ${CMAKE_CTEST_COMMAND}
  1306. --build-and-test
  1307. "${CMake_SOURCE_DIR}/Tests/ExternalProject"
  1308. "${CMake_BINARY_DIR}/Tests/ExternalProject"
  1309. ${build_generator_args}
  1310. --build-project ExternalProjectTest
  1311. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProject"
  1312. --force-new-ctest-process
  1313. --build-options ${build_options}
  1314. --test-command ${CMAKE_CTEST_COMMAND} -V
  1315. )
  1316. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject")
  1317. set_tests_properties(ExternalProject PROPERTIES
  1318. TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1319. add_test(NAME ExternalProjectSubdir
  1320. COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
  1321. --build-and-test
  1322. "${CMake_SOURCE_DIR}/Tests/ExternalProjectSubdir"
  1323. "${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir"
  1324. ${build_generator_args}
  1325. --build-project ExternalProjectSubdir
  1326. --force-new-ctest-process
  1327. --build-options ${build_options}
  1328. )
  1329. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir")
  1330. add_test(NAME ExternalProjectSourceSubdir
  1331. COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
  1332. --build-and-test
  1333. "${CMake_SOURCE_DIR}/Tests/ExternalProjectSourceSubdir"
  1334. "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdir"
  1335. ${build_generator_args}
  1336. --build-project ExternalProjectSourceSubdir
  1337. --force-new-ctest-process
  1338. --build-options ${build_options}
  1339. )
  1340. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSourceSubdir")
  1341. add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND}
  1342. --build-and-test
  1343. "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal"
  1344. "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal"
  1345. ${build_generator_args}
  1346. --build-project ExternalProjectLocalTest
  1347. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal"
  1348. --force-new-ctest-process
  1349. --build-options ${build_options}
  1350. --test-command ${CMAKE_CTEST_COMMAND} -V
  1351. )
  1352. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectLocal")
  1353. set_tests_properties(ExternalProjectLocal PROPERTIES
  1354. TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1355. add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND}
  1356. --build-and-test
  1357. "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate"
  1358. "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
  1359. ${build_generator_args}
  1360. --build-project ExternalProjectUpdateTest
  1361. --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
  1362. --force-new-ctest-process
  1363. --build-options ${build_options}
  1364. --test-command ${CMAKE_CTEST_COMMAND} -V
  1365. )
  1366. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
  1367. set_tests_properties(ExternalProjectUpdateSetup PROPERTIES
  1368. TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  1369. add_test(NAME ExternalProjectUpdate
  1370. COMMAND ${CMAKE_CMAKE_COMMAND}
  1371. -DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
  1372. -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate
  1373. -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
  1374. -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
  1375. -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
  1376. -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}
  1377. -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
  1378. )
  1379. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
  1380. set_tests_properties(ExternalProjectUpdate PROPERTIES
  1381. TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}
  1382. WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
  1383. DEPENDS ExternalProjectUpdateSetup )
  1384. # do each of the tutorial steps
  1385. foreach(STP RANGE 1 7)
  1386. add_test(TutorialStep${STP} ${CMAKE_CTEST_COMMAND}
  1387. --build-and-test
  1388. "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}"
  1389. "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}"
  1390. --build-two-config
  1391. ${build_generator_args}
  1392. --build-project Tutorial
  1393. --build-options ${build_options}
  1394. --test-command Tutorial 25.0)
  1395. endforeach()
  1396. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial")
  1397. add_test(testing ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  1398. --build-and-test
  1399. "${CMake_SOURCE_DIR}/Tests/Testing"
  1400. "${CMake_BINARY_DIR}/Tests/Testing"
  1401. ${build_generator_args}
  1402. --build-project Testing
  1403. --build-options ${build_options}
  1404. --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  1405. )
  1406. set_tests_properties(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed")
  1407. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing")
  1408. add_test(wrapping ${CMAKE_CTEST_COMMAND}
  1409. --build-and-test
  1410. "${CMake_SOURCE_DIR}/Tests/Wrapping"
  1411. "${CMake_BINARY_DIR}/Tests/Wrapping"
  1412. ${build_generator_args}
  1413. --build-project Wrapping
  1414. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  1415. --build-options ${build_options}
  1416. --test-command wrapping
  1417. )
  1418. add_test(qtwrapping ${CMAKE_CTEST_COMMAND}
  1419. --build-and-test
  1420. "${CMake_SOURCE_DIR}/Tests/Wrapping"
  1421. "${CMake_BINARY_DIR}/Tests/Wrapping"
  1422. ${build_generator_args}
  1423. --build-project Wrapping
  1424. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  1425. --build-options ${build_options}
  1426. --test-command qtwrapping
  1427. )
  1428. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Wrapping")
  1429. add_test(testdriver1 ${CMAKE_CTEST_COMMAND}
  1430. --build-and-test
  1431. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  1432. "${CMake_BINARY_DIR}/Tests/TestDriver"
  1433. ${build_generator_args}
  1434. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  1435. --build-project TestDriverTest
  1436. --build-options ${build_options}
  1437. --test-command TestDriverTest test1
  1438. )
  1439. add_test(testdriver2 ${CMAKE_CTEST_COMMAND}
  1440. --build-and-test
  1441. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  1442. "${CMake_BINARY_DIR}/Tests/TestDriver"
  1443. ${build_generator_args}
  1444. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  1445. --build-project TestDriverTest
  1446. --build-options ${build_options}
  1447. --test-command TestDriverTest test2
  1448. )
  1449. add_test(testdriver3 ${CMAKE_CTEST_COMMAND}
  1450. --build-and-test
  1451. "${CMake_SOURCE_DIR}/Tests/TestDriver"
  1452. "${CMake_BINARY_DIR}/Tests/TestDriver"
  1453. ${build_generator_args}
  1454. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
  1455. --build-project TestDriverTest
  1456. --build-options ${build_options}
  1457. --test-command TestDriverTest subdir/test3
  1458. )
  1459. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestDriver")
  1460. add_test(Dependency ${CMAKE_CTEST_COMMAND}
  1461. --build-and-test
  1462. "${CMake_SOURCE_DIR}/Tests/Dependency"
  1463. "${CMake_BINARY_DIR}/Tests/Dependency"
  1464. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
  1465. ${build_generator_args}
  1466. --build-project Dependency
  1467. --build-options ${build_options}
  1468. --test-command exec
  1469. )
  1470. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Dependency")
  1471. if(CMAKE_SYSTEM_NAME MATCHES syllable)
  1472. # RPATH isn't supported under Syllable, so the tests don't
  1473. # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR
  1474. # in the tests would have to be adjusted to ${EXECUTABLE_OUTPUT_DIR}/lib .
  1475. # For now we just require on Syllable that the user adjusts the DLL_PATH
  1476. # environment variable, so except the two tests below all other tests will succeed.
  1477. set(_DLL_PATH "$ENV{DLL_PATH}")
  1478. if(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.(:.*)?$")
  1479. 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")
  1480. endif()
  1481. if(NOT "${_DLL_PATH}" MATCHES "^(.*:)?\\@bindir\\@/\\.\\./lib(:.*)?$")
  1482. 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")
  1483. endif()
  1484. else()
  1485. add_test(JumpWithLibOut ${CMAKE_CTEST_COMMAND}
  1486. --build-and-test
  1487. "${CMake_SOURCE_DIR}/Tests/Jump"
  1488. "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut"
  1489. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable"
  1490. --build-project Jump
  1491. ${build_generator_args}
  1492. --build-options ${build_options}
  1493. -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib
  1494. --test-command jumpExecutable
  1495. )
  1496. add_test(JumpNoLibOut ${CMAKE_CTEST_COMMAND}
  1497. --build-and-test
  1498. "${CMake_SOURCE_DIR}/Tests/Jump"
  1499. "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut"
  1500. --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
  1501. --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable"
  1502. --build-project Jump
  1503. ${build_generator_args}
  1504. --build-options ${build_options}
  1505. --test-command jumpExecutable
  1506. )
  1507. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Jump")
  1508. add_test(Plugin ${CMAKE_CTEST_COMMAND}
  1509. --build-and-test
  1510. "${CMake_SOURCE_DIR}/Tests/Plugin"
  1511. "${CMake_BINARY_DIR}/Tests/Plugin"
  1512. ${build_generator_args}
  1513. --build-project Plugin
  1514. --build-two-config
  1515. --build-options ${build_options}
  1516. --test-command bin/example)
  1517. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Plugin")
  1518. if(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
  1519. ADD_TEST_MACRO(RuntimePath RuntimePath)
  1520. endif()
  1521. endif()
  1522. if(APPLE AND "${DARWIN_MAJOR_VERSION}" GREATER 9)
  1523. add_test(MacRuntimePath ${CMAKE_CTEST_COMMAND}
  1524. --build-and-test
  1525. "${CMake_SOURCE_DIR}/Tests/MacRuntimePath"
  1526. "${CMake_BINARY_DIR}/Tests/MacRuntimePath"
  1527. ${build_generator_args}
  1528. --build-project MacRuntimePath
  1529. --build-options ${build_options}
  1530. -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
  1531. )
  1532. endif()
  1533. if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5
  1534. AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
  1535. set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1} -DCMAKE_OSX_SYSROOT=macosx)
  1536. ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V)
  1537. endif()
  1538. add_test(linkorder1 ${CMAKE_CTEST_COMMAND}
  1539. --build-and-test
  1540. "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
  1541. "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
  1542. ${build_generator_args}
  1543. --build-project LinkLineOrder
  1544. --build-options ${build_options}
  1545. --test-command Exec1
  1546. )
  1547. add_test(linkorder2 ${CMAKE_CTEST_COMMAND}
  1548. --build-and-test
  1549. "${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
  1550. "${CMake_BINARY_DIR}/Tests/LinkLineOrder"
  1551. ${build_generator_args}
  1552. --build-project LinkLineOrder
  1553. --build-options ${build_options}
  1554. --test-command Exec2
  1555. )
  1556. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder")
  1557. set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping)
  1558. set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping)
  1559. set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1)
  1560. set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2)
  1561. set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1)
  1562. set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall)
  1563. # Test static linking on toolchains known to support it.
  1564. if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
  1565. AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN
  1566. AND EXISTS "/usr/lib/libm.a")
  1567. add_test(LinkStatic ${CMAKE_CTEST_COMMAND}
  1568. --build-and-test
  1569. "${CMake_SOURCE_DIR}/Tests/LinkStatic"
  1570. "${CMake_BINARY_DIR}/Tests/LinkStatic"
  1571. ${build_generator_args}
  1572. --build-project LinkStatic
  1573. --build-options ${build_options}
  1574. -DMATH_LIBRARY:FILEPATH=/usr/lib/libm.a
  1575. --test-command LinkStatic
  1576. )
  1577. endif()
  1578. if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
  1579. add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
  1580. --build-and-test
  1581. "${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
  1582. "${CMake_BINARY_DIR}/Tests/SubDirSpaces"
  1583. --build-exe-dir
  1584. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources"
  1585. ${build_generator_args}
  1586. --build-project SUBDIR
  1587. --build-options ${build_options}
  1588. --test-command test
  1589. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/ShouldBeHere"
  1590. "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj"
  1591. )
  1592. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces")
  1593. endif ()
  1594. if (WIN32)
  1595. add_test(SubDir ${CMAKE_CTEST_COMMAND}
  1596. --build-and-test
  1597. "${CMake_SOURCE_DIR}/Tests/SubDir"
  1598. "${CMake_BINARY_DIR}/Tests/SubDir"
  1599. --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
  1600. ${build_generator_args}
  1601. --build-project SUBDIR
  1602. --build-options ${build_options}
  1603. --test-command test
  1604. "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
  1605. "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj"
  1606. )
  1607. else ()
  1608. add_test(SubDir ${CMAKE_CTEST_COMMAND}
  1609. --build-and-test
  1610. "${CMake_SOURCE_DIR}/Tests/SubDir"
  1611. "${CMake_BINARY_DIR}/Tests/SubDir"
  1612. --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable"
  1613. ${build_generator_args}
  1614. --build-project SUBDIR
  1615. --build-options ${build_options}
  1616. --test-command test
  1617. "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere"
  1618. "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o"
  1619. )
  1620. endif ()
  1621. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
  1622. if(MSVC)
  1623. ADD_TEST_MACRO(ForceInclude foo)
  1624. ADD_TEST_MACRO(PDBDirectoryAndName myexe)
  1625. if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
  1626. ADD_TEST_MACRO(PrecompiledHeader foo)
  1627. endif()
  1628. endif()
  1629. if(MSVC OR
  1630. "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles")
  1631. ADD_TEST_MACRO(ModuleDefinition example_exe)
  1632. endif()
  1633. ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables)
  1634. if("${CMAKE_GENERATOR}" MATCHES "Makefile")
  1635. add_test(MakeClean ${CMAKE_CTEST_COMMAND}
  1636. --build-and-test
  1637. "${CMake_SOURCE_DIR}/Tests/MakeClean"
  1638. "${CMake_BINARY_DIR}/Tests/MakeClean"
  1639. ${build_generator_args}
  1640. --build-project MakeClean
  1641. --build-exe-dir "${CMake_BINARY_DIR}/MakeClean"
  1642. --build-options ${build_options}
  1643. --test-command check_clean
  1644. )
  1645. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
  1646. endif()
  1647. if(NOT DEFINED CTEST_RUN_MFC)
  1648. set(CTEST_RUN_MFC OFF)
  1649. if(MSVC)
  1650. set(CTEST_RUN_MFC ON)
  1651. # Look for evidence that this is a VCExpress build. If so, avoid
  1652. # the MFC test by default.
  1653. string(TOLOWER "${CMAKE_MAKE_PROGRAM}" mkprog)
  1654. if(mkprog MATCHES "vcexpress")
  1655. message(STATUS
  1656. "CMAKE_MAKE_PROGRAM indicates vcexpress, avoiding MFC test")
  1657. set(CTEST_RUN_MFC OFF)
  1658. endif()
  1659. # Since MSBuild might also be the "makeprogram" for a VCExpress
  1660. # build tree, use one more heuristic, too. The string representing
  1661. # the .vcproj file type contains "VCExpress" on machines where an
  1662. # express edition of VS was installed last:
  1663. if(CTEST_RUN_MFC)
  1664. execute_process(COMMAND cmd /c assoc .vcproj
  1665. OUTPUT_STRIP_TRAILING_WHITESPACE
  1666. OUTPUT_VARIABLE ov)
  1667. if(ov MATCHES "VCExpress")
  1668. message(STATUS
  1669. ".vcproj file association indicates VCExpress, avoiding MFC test")
  1670. set(CTEST_RUN_MFC OFF)
  1671. endif()
  1672. endif()
  1673. # For the Watcom WMake generator, avoid the MFC test by default.
  1674. if(CTEST_RUN_MFC)
  1675. if("${CMAKE_GENERATOR}" MATCHES "WMake")
  1676. message(STATUS
  1677. "using the Watcom WMake generator, avoiding MFC test")
  1678. set(CTEST_RUN_MFC OFF)
  1679. endif()
  1680. endif()
  1681. # Last resort, after quick checks are done. Do a try_compile, and avoid
  1682. # the MFC test if the simplest possible MFC app cannot be compiled.
  1683. if(CTEST_RUN_MFC AND NOT DEFINED HAVE_MFC)
  1684. configure_file(
  1685. ${CMAKE_CURRENT_SOURCE_DIR}/MFC/try_compile/CMakeLists.txt
  1686. ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/CMakeLists.txt
  1687. COPYONLY
  1688. )
  1689. configure_file(
  1690. ${CMAKE_CURRENT_SOURCE_DIR}/MFC/mfc1/stdafx.cpp
  1691. ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/stdafx.cpp
  1692. COPYONLY
  1693. )
  1694. configure_file(
  1695. ${CMAKE_CURRENT_SOURCE_DIR}/MFC/mfc1/stdafx.h
  1696. ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/stdafx.h
  1697. COPYONLY
  1698. )
  1699. message(STATUS "Looking for MFC")
  1700. try_compile(HAVE_MFC
  1701. ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/build
  1702. ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile
  1703. try_compile_mfc
  1704. OUTPUT_VARIABLE HAVE_MFC_OUTPUT)
  1705. if(HAVE_MFC)
  1706. message(STATUS "Looking for MFC - found")
  1707. set(HAVE_MFC 1 CACHE INTERNAL "Have MFC")
  1708. file(APPEND
  1709. ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
  1710. "Determining if MFC exists passed with the following output:\n"
  1711. "${HAVE_MFC_OUTPUT}\n\n")
  1712. else()
  1713. message(STATUS "Looking for MFC - not found")
  1714. set(HAVE_MFC "" CACHE INTERNAL "Have MFC")
  1715. file(APPEND
  1716. ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
  1717. "Determining if MFC exists failed with the following output:\n"
  1718. "${HAVE_MFC_OUTPUT}\n\n")
  1719. endif()
  1720. endif()
  1721. if(CTEST_RUN_MFC AND NOT HAVE_MFC)
  1722. message(STATUS
  1723. "cannot compile simplest ever MFC app, avoiding MFC test")
  1724. set(CTEST_RUN_MFC OFF)
  1725. endif()
  1726. endif()
  1727. endif()
  1728. if(CTEST_RUN_MFC)
  1729. add_test(MFC ${CMAKE_CTEST_COMMAND}
  1730. --build-and-test
  1731. "${CMake_SOURCE_DIR}/Tests/MFC"
  1732. "${CMake_BINARY_DIR}/Tests/MFC"
  1733. --build-two-config
  1734. ${build_generator_args}
  1735. --build-project mfc_driver
  1736. --build-options ${build_options}
  1737. --test-command ${CMAKE_CTEST_COMMAND}
  1738. -C \${CTEST_CONFIGURATION_TYPE} -VV)
  1739. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC")
  1740. endif()
  1741. if(MSVC AND NOT MSVC_VERSION LESS 1310
  1742. AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7( |$)"
  1743. AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)"
  1744. OR CMAKE_SIZEOF_VOID_P EQUAL 4)
  1745. )
  1746. ADD_TEST_MACRO(VSMASM VSMASM)
  1747. endif()
  1748. if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
  1749. if(NOT MSVC60)
  1750. ADD_TEST_MACRO(SBCS SBCS)
  1751. endif()
  1752. if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [789]( |$)"
  1753. AND NOT CMAKE_GENERATOR_TOOLSET)
  1754. ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx)
  1755. endif()
  1756. add_test(VSExternalInclude ${CMAKE_CTEST_COMMAND}
  1757. --build-and-test
  1758. "${CMake_SOURCE_DIR}/Tests/VSExternalInclude"
  1759. "${CMake_BINARY_DIR}/Tests/VSExternalInclude"
  1760. --build-two-config
  1761. ${build_generator_args}
  1762. --build-project VSExternalInclude
  1763. --build-options ${build_options}
  1764. --test-command VSExternalInclude)
  1765. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExternalInclude")
  1766. add_test(VSMidl ${CMAKE_CTEST_COMMAND}
  1767. --build-and-test
  1768. "${CMake_SOURCE_DIR}/Tests/VSMidl"
  1769. "${CMake_BINARY_DIR}/Tests/VSMidl"
  1770. --build-two-config
  1771. ${build_generator_args}
  1772. --build-project VSMidl
  1773. --build-options ${build_options}
  1774. --test-command VSMidl)
  1775. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl")
  1776. if(CMake_TEST_DEVENV)
  1777. # The test (and tested property) works with .sln files, so it's skipped when:
  1778. # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file
  1779. set(_last_test "")
  1780. foreach(config ${CMAKE_CONFIGURATION_TYPES})
  1781. add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND}
  1782. --build-and-test
  1783. "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild"
  1784. "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
  1785. --build-config ${config}
  1786. --build-two-config
  1787. --build-generator ${CMAKE_GENERATOR}
  1788. --build-makeprogram ${CMake_TEST_DEVENV}
  1789. --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
  1790. --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
  1791. --build-project VSExcludeFromDefaultBuild
  1792. --build-target install
  1793. --test-command ${CMAKE_COMMAND}
  1794. -D "activeConfig=${config}"
  1795. -D "allConfigs=${CMAKE_CONFIGURATION_TYPES}"
  1796. -D "dir=${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
  1797. -P "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake")
  1798. if(_last_test)
  1799. set_property(TEST VSExcludeFromDefaultBuild-${config} PROPERTY DEPENDS ${_last_test})
  1800. endif()
  1801. set(_last_test "VSExcludeFromDefaultBuild-${config}")
  1802. endforeach()
  1803. unset(_last_test)
  1804. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild")
  1805. endif()
  1806. if(CMAKE_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])")
  1807. # This is Visual Studio 10 or above, so the default build tool is MSBuild.
  1808. add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND}
  1809. --build-and-test
  1810. "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir"
  1811. "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir"
  1812. --build-two-config
  1813. --build-generator ${CMAKE_GENERATOR}
  1814. --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
  1815. --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
  1816. --build-project VSProjectInSubdir
  1817. --build-target test)
  1818. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
  1819. endif()
  1820. endif()
  1821. if(WIN32)
  1822. # Macro to search for available Windows CE SDKs in the windows Registry
  1823. macro(select_wince_sdk selected_reg selected_sdk)
  1824. if(CMAKE_HOST_WIN32)
  1825. execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs"
  1826. OUTPUT_VARIABLE sdk_reg
  1827. ERROR_VARIABLE my_err)
  1828. string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}")
  1829. list(LENGTH sdk_list sdk_list_len)
  1830. if (${sdk_list_len} GREATER 1)
  1831. list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above
  1832. string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name
  1833. endif()
  1834. # Build a key to be used by get_filename_component that is pointing to the SDK directory
  1835. set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]")
  1836. # Set return values
  1837. set(${selected_reg} ${_reg})
  1838. set(${selected_sdk} ${_sdk})
  1839. endif(CMAKE_HOST_WIN32)
  1840. endmacro(select_wince_sdk)
  1841. set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]")
  1842. set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]")
  1843. set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]")
  1844. set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]")
  1845. set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]")
  1846. set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]")
  1847. set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]")
  1848. set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]")
  1849. set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]")
  1850. select_wince_sdk(reg_wince wince_sdk)
  1851. set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]")
  1852. foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra)
  1853. get_filename_component(r "${reg_${reg}}" ABSOLUTE)
  1854. if(IS_DIRECTORY "${r}")
  1855. set(${reg} 1)
  1856. else()
  1857. set(${reg} 0)
  1858. endif()
  1859. endforeach()
  1860. endif()
  1861. get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME)
  1862. if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0
  1863. macro(add_test_VSWinStorePhone name generator systemName systemVersion)
  1864. add_test(NAME VSWinStorePhone.${name} COMMAND ${CMAKE_CTEST_COMMAND}
  1865. --build-and-test
  1866. "${CMake_SOURCE_DIR}/Tests/VSWinStorePhone"
  1867. "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}"
  1868. --build-generator "${generator}"
  1869. --build-project VSWinStorePhone
  1870. --build-config $<CONFIGURATION>
  1871. --build-options -DCMAKE_SYSTEM_NAME=${systemName}
  1872. -DCMAKE_SYSTEM_VERSION=${systemVersion}
  1873. )
  1874. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}")
  1875. endmacro()
  1876. if(vs11 AND ws80)
  1877. add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0)
  1878. add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012 ARM" WindowsStore 8.0)
  1879. add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012 Win64" WindowsStore 8.0)
  1880. endif()
  1881. if(vs12 AND ws81)
  1882. add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1)
  1883. add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013 ARM" WindowsStore 8.1)
  1884. add_test_VSWinStorePhone(vs12-store81-X64 "Visual Studio 12 2013 Win64" WindowsStore 8.1)
  1885. add_test(NAME VSXaml COMMAND ${CMAKE_CTEST_COMMAND}
  1886. --build-and-test
  1887. "${CMake_SOURCE_DIR}/Tests/VSXaml"
  1888. "${CMake_BINARY_DIR}/Tests/VSXaml"
  1889. --build-generator "Visual Studio 12 2013"
  1890. --build-project VSXaml
  1891. --build-config $<CONFIGURATION>
  1892. --build-options -DCMAKE_SYSTEM_NAME=WindowsStore
  1893. -DCMAKE_SYSTEM_VERSION=8.1
  1894. )
  1895. endif()
  1896. if(vs14 AND ws10_0)
  1897. add_test_VSWinStorePhone(vs14-store10_0-X86 "Visual Studio 14 2015" WindowsStore 10.0)
  1898. add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015 ARM" WindowsStore 10.0)
  1899. add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015 Win64" WindowsStore 10.0)
  1900. endif()
  1901. if(vs11 AND wp80)
  1902. add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0)
  1903. add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012 ARM" WindowsPhone 8.0)
  1904. endif()
  1905. if(vs12 AND wp81)
  1906. add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1)
  1907. add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013 ARM" WindowsPhone 8.1)
  1908. endif()
  1909. endif()
  1910. if(WIN32 AND wince)
  1911. macro(add_test_VSWinCE name generator systemName systemVersion generatorPlatform)
  1912. # TODO: Fix the tutorial to make it work in cross compile
  1913. # currently the MakeTable is build for target and can not be used on the host
  1914. # This happens in part 5 so we build only part 1-4 of the tutorial
  1915. foreach(STP RANGE 1 4)
  1916. add_test(NAME "TutorialStep${STP}.${name}" COMMAND ${CMAKE_CTEST_COMMAND}
  1917. --build-and-test
  1918. "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}"
  1919. "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}"
  1920. --build-generator "${generator}"
  1921. --build-project Tutorial
  1922. --build-config $<CONFIGURATION>
  1923. --build-options -DCMAKE_SYSTEM_NAME=${systemName}
  1924. -DCMAKE_SYSTEM_VERSION=${systemVersion}
  1925. -DCMAKE_GENERATOR_PLATFORM=${generatorPlatform})
  1926. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}")
  1927. endforeach()
  1928. endmacro()
  1929. if(vs11)
  1930. add_test_VSWinCE(vs11-ce80-ARM "Visual Studio 11 2012" WindowsCE 8.0 ${wince_sdk})
  1931. endif()
  1932. if(vs12)
  1933. add_test_VSWinCE(vs12-ce80-ARM "Visual Studio 12 2013" WindowsCE 8.0 ${wince_sdk})
  1934. endif()
  1935. endif()
  1936. if (CMake_TEST_GreenHillsMULTI)
  1937. macro(add_test_GhsMulti name primaryTarget bspName)
  1938. add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND}
  1939. --build-and-test
  1940. "${CMake_SOURCE_DIR}/Tests/GhsMulti"
  1941. "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}"
  1942. --build-generator "Green Hills MULTI"
  1943. --build-project ReturnNum
  1944. --build-config $<CONFIGURATION>
  1945. --build-options -DGHS_PRIMARY_TARGET=${primaryTarget}
  1946. -DGHS_BSP_NAME=${bspName}
  1947. )
  1948. endmacro ()
  1949. add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm")
  1950. add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm")
  1951. add_test(NAME GhsMulti.duplicate_source_filenames
  1952. COMMAND ${CMAKE_CTEST_COMMAND}
  1953. --build-and-test
  1954. "${CMake_SOURCE_DIR}/Tests/GhsMultiDuplicateSourceFilenames"
  1955. "${CMake_BINARY_DIR}/Tests/GhsMultiDuplicateSourceFilenames"
  1956. --build-generator "Green Hills MULTI"
  1957. --build-project ReturnNum
  1958. --build-config $<CONFIGURATION>
  1959. --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt"
  1960. -DGHS_BSP_NAME="simarm"
  1961. )
  1962. endif ()
  1963. if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ")
  1964. macro(add_test_VSNsightTegra name generator)
  1965. add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND}
  1966. --build-and-test
  1967. "${CMake_SOURCE_DIR}/Tests/VSNsightTegra"
  1968. "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}"
  1969. --build-generator "${generator}"
  1970. --build-project VSNsightTegra
  1971. --build-config $<CONFIGURATION>
  1972. --build-options -DCMAKE_SYSTEM_NAME=Android
  1973. )
  1974. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSNsightTegra/${name}")
  1975. endmacro()
  1976. if(vs10)
  1977. add_test_VSNsightTegra(vs10 "Visual Studio 10 2010")
  1978. endif()
  1979. if(vs11)
  1980. add_test_VSNsightTegra(vs11 "Visual Studio 11 2012")
  1981. endif()
  1982. if(vs12)
  1983. add_test_VSNsightTegra(vs12 "Visual Studio 12 2013")
  1984. endif()
  1985. if(vs14)
  1986. add_test_VSNsightTegra(vs14 "Visual Studio 14 2015")
  1987. endif()
  1988. endif()
  1989. if (APPLE)
  1990. if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
  1991. set(BundleTestInstallDir
  1992. "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory")
  1993. add_test(BundleTest ${CMAKE_CTEST_COMMAND}
  1994. --build-and-test
  1995. "${CMake_SOURCE_DIR}/Tests/BundleTest"
  1996. "${CMake_BINARY_DIR}/Tests/BundleTest"
  1997. --build-two-config
  1998. ${build_generator_args}
  1999. --build-project BundleTest
  2000. --build-target install
  2001. # --build-target package
  2002. --build-options ${build_options}
  2003. "-DCMAKE_INSTALL_PREFIX:PATH=${BundleTestInstallDir}"
  2004. "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
  2005. --test-command
  2006. ${BundleTestInstallDir}/Applications/SecondBundleExe.app/Contents/MacOS/SecondBundleExe)
  2007. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleTest")
  2008. add_test(NAME CFBundleTest COMMAND ${CMAKE_CTEST_COMMAND}
  2009. --build-and-test
  2010. "${CMake_SOURCE_DIR}/Tests/CFBundleTest"
  2011. "${CMake_BINARY_DIR}/Tests/CFBundleTest"
  2012. --build-two-config
  2013. ${build_generator_args}
  2014. --build-project CFBundleTest
  2015. --build-config $<CONFIGURATION>
  2016. --build-options ${build_options}
  2017. --test-command
  2018. ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=$<CONFIGURATION>
  2019. -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest
  2020. -Dgen=${CMAKE_GENERATOR}
  2021. -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake)
  2022. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest")
  2023. ADD_TEST_MACRO(ObjC++ ObjC++)
  2024. endif ()
  2025. endif ()
  2026. if(APPLE AND CTEST_TEST_CPACK)
  2027. add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND}
  2028. --build-and-test
  2029. "${CMake_SOURCE_DIR}/Tests/BundleGeneratorTest"
  2030. "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest"
  2031. --build-two-config
  2032. ${build_generator_args}
  2033. --build-project BundleGeneratorTest
  2034. --build-target package
  2035. --build-options ${build_options}
  2036. "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
  2037. )
  2038. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
  2039. endif()
  2040. add_test(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND}
  2041. --build-and-test
  2042. "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaSet"
  2043. "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet"
  2044. ${build_generator_args}
  2045. --build-noclean
  2046. --build-project WarnUnusedUnusedViaSet
  2047. --build-options ${build_options}
  2048. "--warn-unused-vars")
  2049. set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
  2050. PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'")
  2051. set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
  2052. FAIL_REGULAR_EXPRESSION "unused variable \\(unsetting\\) 'UNUSED_VARIABLE'")
  2053. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet")
  2054. add_test(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND}
  2055. --build-and-test
  2056. "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaUnset"
  2057. "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset"
  2058. ${build_generator_args}
  2059. --build-noclean
  2060. --build-project WarnUnusedUnusedViaUnset
  2061. --build-options ${build_options}
  2062. "--warn-unused-vars")
  2063. set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
  2064. PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):")
  2065. set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
  2066. FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):")
  2067. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
  2068. if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32)
  2069. # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails
  2070. # this test. (See #13371)
  2071. # Apparently Visual Studio does not support it either. As the MakeClean
  2072. # test above is only run with the Makefiles generator, only run this
  2073. # test with the Makefiles generator also.
  2074. add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
  2075. --build-and-test
  2076. "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused"
  2077. "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
  2078. ${build_generator_args}
  2079. --build-project WarnUnusedCliUnused
  2080. --build-options ${build_options}
  2081. "-DUNUSED_CLI_VARIABLE=Unused")
  2082. set_tests_properties(WarnUnusedCliUnused PROPERTIES
  2083. PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
  2084. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
  2085. endif()
  2086. add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND}
  2087. --build-and-test
  2088. "${CMake_SOURCE_DIR}/Tests/VariableUsage"
  2089. "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed"
  2090. ${build_generator_args}
  2091. --build-noclean
  2092. --build-project WarnUnusedCliUsed
  2093. --build-options ${build_options}
  2094. "-DUSED_VARIABLE=Usage proven")
  2095. set_tests_properties(WarnUnusedCliUsed PROPERTIES
  2096. PASS_REGULAR_EXPRESSION "Usage proven")
  2097. set_tests_properties(WarnUnusedCliUsed PROPERTIES
  2098. FAIL_REGULAR_EXPRESSION "CMake Warning: The variable, 'USED_VARIABLE'")
  2099. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed")
  2100. add_test(WarnUninitialized ${CMAKE_CTEST_COMMAND}
  2101. --build-and-test
  2102. "${CMake_SOURCE_DIR}/Tests/VariableUsage"
  2103. "${CMake_BINARY_DIR}/Tests/WarnUninitialized"
  2104. ${build_generator_args}
  2105. --build-noclean
  2106. --build-project WarnUninitialized
  2107. --build-options ${build_options}
  2108. "--warn-uninitialized")
  2109. set_tests_properties(WarnUninitialized PROPERTIES
  2110. PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'")
  2111. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized")
  2112. add_test(TestsWorkingDirectory
  2113. ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
  2114. --build-and-test
  2115. "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory"
  2116. "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
  2117. ${build_generator_args}
  2118. --build-project TestsWorkingDirectoryProj
  2119. --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
  2120. --force-new-ctest-process
  2121. --build-options ${build_options}
  2122. --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE}
  2123. )
  2124. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
  2125. # Make sure CTest can handle a test with no newline in output.
  2126. add_test(CTest.NoNewline
  2127. ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!")
  2128. # A simple test for ctest in script mode
  2129. configure_file("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in"
  2130. "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake" @ONLY)
  2131. # add_test(CTest.ScriptMode ${CMAKE_CTEST_COMMAND}
  2132. # -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake"
  2133. # )
  2134. # A test for ctest_build() with targets in subdirectories
  2135. set(ctest_configure_options)
  2136. if(CMAKE_GENERATOR_PLATFORM)
  2137. list(APPEND ctest_configure_options -A ${CMAKE_GENERATOR_PLATFORM})
  2138. endif()
  2139. if(CMAKE_GENERATOR_TOOLSET)
  2140. list(APPEND ctest_configure_options -T ${CMAKE_GENERATOR_TOOLSET})
  2141. endif()
  2142. if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
  2143. list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
  2144. endif()
  2145. configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in"
  2146. "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY)
  2147. unset(ctest_configure_options)
  2148. add_test(CTest.BuildCommand.ProjectInSubdir
  2149. ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake")
  2150. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested")
  2151. set(CTEST_TEST_UPDATE 1)
  2152. if(CTEST_TEST_UPDATE)
  2153. # Test CTest Update with Subversion
  2154. find_package(Subversion QUIET)
  2155. if(Subversion_FOUND)
  2156. get_filename_component(_Subversion_BIN_DIR
  2157. ${Subversion_SVN_EXECUTABLE} PATH)
  2158. find_program(Subversion_SVNADMIN_EXECUTABLE svnadmin
  2159. HINTS ${_Subversion_BIN_DIR}
  2160. )
  2161. mark_as_advanced(Subversion_SVNADMIN_EXECUTABLE)
  2162. if(NOT Subversion_SVNADMIN_EXECUTABLE)
  2163. set(Subversion_FOUND FALSE)
  2164. endif()
  2165. endif()
  2166. if(Subversion_FOUND)
  2167. set(CTestUpdateSVN_DIR "CTest UpdateSVN")
  2168. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateSVN.cmake.in"
  2169. "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake" @ONLY)
  2170. add_test(CTest.UpdateSVN ${CMAKE_CMAKE_COMMAND}
  2171. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateSVN.cmake"
  2172. )
  2173. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateSVN_DIR}")
  2174. endif()
  2175. # Test CTest Update with CVS
  2176. if(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake)
  2177. find_package(CVS QUIET)
  2178. else()
  2179. find_program(CVS_EXECUTABLE NAMES cvs)
  2180. set(CVS_FOUND ${CVS_EXECUTABLE})
  2181. endif()
  2182. set(CTEST_TEST_UPDATE_CVS ${CVS_FOUND})
  2183. if(CTEST_TEST_UPDATE_CVS AND NOT UNIX)
  2184. if("${CVS_EXECUTABLE}" MATCHES "cygwin")
  2185. message(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!")
  2186. set(CTEST_TEST_UPDATE_CVS 0)
  2187. endif()
  2188. endif()
  2189. if(CTEST_TEST_UPDATE_CVS)
  2190. set(CTestUpdateCVS_DIR "CTest UpdateCVS")
  2191. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in"
  2192. "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY)
  2193. add_test(CTest.UpdateCVS ${CMAKE_CMAKE_COMMAND}
  2194. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake"
  2195. )
  2196. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}")
  2197. endif()
  2198. # Test CTest Update with BZR
  2199. find_program(BZR_EXECUTABLE NAMES bzr)
  2200. mark_as_advanced(BZR_EXECUTABLE)
  2201. set(CTEST_TEST_UPDATE_BZR 0)
  2202. if(BZR_EXECUTABLE)
  2203. if(NOT "${BZR_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  2204. set(CTEST_TEST_UPDATE_BZR 1)
  2205. endif()
  2206. endif()
  2207. if(CTEST_TEST_UPDATE_BZR)
  2208. # Check if xmloutput plugin is there
  2209. execute_process(COMMAND ${BZR_EXECUTABLE} xmlplugins RESULT_VARIABLE xmlplugres
  2210. OUTPUT_QUIET ERROR_QUIET)
  2211. if( NOT ${xmlplugres} )
  2212. set(CTestUpdateBZR_DIR "CTest UpdateBZR")
  2213. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in"
  2214. "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake" @ONLY)
  2215. add_test(CTest.UpdateBZR ${CMAKE_CMAKE_COMMAND}
  2216. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR.cmake"
  2217. )
  2218. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}")
  2219. set(CTestUpdateBZR_DIR "CTest UpdateBZR_CLocale")
  2220. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateBZR.cmake.in"
  2221. "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake" @ONLY)
  2222. add_test(CTest.UpdateBZR.CLocale ${CMAKE_CMAKE_COMMAND}
  2223. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateBZR_CLocale.cmake"
  2224. )
  2225. set_tests_properties(CTest.UpdateBZR.CLocale PROPERTIES ENVIRONMENT LC_ALL=C)
  2226. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateBZR_DIR}")
  2227. endif()
  2228. endif()
  2229. # Test CTest Update with GIT
  2230. find_program(GIT_EXECUTABLE NAMES git)
  2231. mark_as_advanced(GIT_EXECUTABLE)
  2232. set(CTEST_TEST_UPDATE_GIT 0)
  2233. if(GIT_EXECUTABLE)
  2234. if(NOT "${GIT_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  2235. set(CTEST_TEST_UPDATE_GIT 1)
  2236. endif()
  2237. endif()
  2238. if(CTEST_TEST_UPDATE_GIT)
  2239. set(CTestUpdateGIT_DIR "CTest UpdateGIT")
  2240. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateGIT.cmake.in"
  2241. "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" @ONLY)
  2242. add_test(CTest.UpdateGIT ${CMAKE_CMAKE_COMMAND}
  2243. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake"
  2244. )
  2245. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}")
  2246. endif()
  2247. # Test CTest Update with HG
  2248. find_program(HG_EXECUTABLE NAMES hg)
  2249. mark_as_advanced(HG_EXECUTABLE)
  2250. set(CTEST_TEST_UPDATE_HG 0)
  2251. if(HG_EXECUTABLE)
  2252. if(NOT "${HG_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  2253. set(CTEST_TEST_UPDATE_HG 1)
  2254. endif()
  2255. endif()
  2256. if(CTEST_TEST_UPDATE_HG)
  2257. set(CTestUpdateHG_DIR "CTest UpdateHG")
  2258. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateHG.cmake.in"
  2259. "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake" @ONLY)
  2260. add_test(CTest.UpdateHG ${CMAKE_CMAKE_COMMAND}
  2261. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateHG.cmake"
  2262. )
  2263. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateHG_DIR}")
  2264. endif()
  2265. # Test CTest Update with P4
  2266. find_program(P4_EXECUTABLE NAMES p4)
  2267. find_program(P4D_EXECUTABLE NAMES p4d)
  2268. mark_as_advanced(P4_EXECUTABLE P4D_EXECUTABLE)
  2269. set(CTEST_TEST_UPDATE_P4 0)
  2270. if(P4_EXECUTABLE AND P4D_EXECUTABLE)
  2271. if(NOT "${P4_EXECUTABLE};${P4D_EXECUTABLE}" MATCHES "cygwin" OR UNIX)
  2272. set(CTEST_TEST_UPDATE_P4 1)
  2273. endif()
  2274. endif()
  2275. if(CTEST_TEST_UPDATE_P4)
  2276. set(CTestUpdateP4_DIR "CTest UpdateP4")
  2277. configure_file("${CMake_SOURCE_DIR}/Tests/CTestUpdateP4.cmake.in"
  2278. "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake" @ONLY)
  2279. add_test(CTest.UpdateP4 ${CMAKE_CMAKE_COMMAND}
  2280. -P "${CMake_BINARY_DIR}/Tests/CTestUpdateP4.cmake"
  2281. )
  2282. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateP4_DIR}")
  2283. endif()
  2284. endif()
  2285. configure_file(
  2286. "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoBuild.cmake.in"
  2287. "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake"
  2288. @ONLY ESCAPE_QUOTES)
  2289. add_test(CTestTestNoBuild ${CMAKE_CTEST_COMMAND}
  2290. -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoBuild.cmake" -V
  2291. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut1.log"
  2292. )
  2293. set_tests_properties(CTestTestNoBuild PROPERTIES
  2294. FAIL_REGULAR_EXPRESSION "Error" WILL_FAIL true)
  2295. configure_file(
  2296. "${CMake_SOURCE_DIR}/Tests/CTestTestFailure/testNoExe.cmake.in"
  2297. "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake"
  2298. @ONLY ESCAPE_QUOTES)
  2299. add_test(CTestTestNoExe ${CMAKE_CTEST_COMMAND}
  2300. -S "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testNoExe.cmake" -V
  2301. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFailure/testOut2.log"
  2302. )
  2303. set_tests_properties(CTestTestNoExe PROPERTIES DEPENDS CTestTestNoBuild
  2304. PASS_REGULAR_EXPRESSION "Could not find executable"
  2305. FAIL_REGULAR_EXPRESSION "SegFault")
  2306. configure_file(
  2307. "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in"
  2308. "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake"
  2309. @ONLY ESCAPE_QUOTES)
  2310. add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND}
  2311. -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V
  2312. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log"
  2313. )
  2314. set_tests_properties(CTestTestUpload PROPERTIES
  2315. PASS_REGULAR_EXPRESSION "Upload\\.xml")
  2316. configure_file(
  2317. "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
  2318. "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake"
  2319. @ONLY ESCAPE_QUOTES)
  2320. add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND}
  2321. -C \${CTEST_CONFIGURATION_TYPE}
  2322. -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV
  2323. --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log"
  2324. )
  2325. set_tests_properties(CTestCoverageCollectGCOV PROPERTIES
  2326. PASS_REGULAR_EXPRESSION
  2327. "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov")
  2328. set_property(TEST CTestCoverageCollectGCOV PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
  2329. configure_file(
  2330. "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
  2331. "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake"
  2332. @ONLY ESCAPE_QUOTES)
  2333. add_test(CTestTestEmptyBinaryDirectory ${CMAKE_CTEST_COMMAND}
  2334. -S "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake" -V
  2335. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestEmptyBinaryDirectory/testOut.log"
  2336. )
  2337. set_tests_properties(CTestTestEmptyBinaryDirectory PROPERTIES
  2338. PASS_REGULAR_EXPRESSION "TEST_SUCCESS")
  2339. # test coverage for mumps
  2340. # create a MumpsCoverage dir in the binary tree under Testing to
  2341. # avoid the .NoDartCoverage files in the cmake testing tree
  2342. configure_file(
  2343. "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/DartConfiguration.tcl.in"
  2344. "${CMake_BINARY_DIR}/Testing/MumpsCoverage/DartConfiguration.tcl")
  2345. configure_file(
  2346. "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/gtm_coverage.mcov.in"
  2347. "${CMake_BINARY_DIR}/Testing/MumpsCoverage/gtm_coverage.mcov")
  2348. file(REMOVE_RECURSE "${CMake_BINARY_DIR}/Testing/MumpsCoverage/VistA-FOIA")
  2349. file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
  2350. DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCoverage")
  2351. add_test(NAME CTestGTMCoverage
  2352. COMMAND cmake -E chdir
  2353. ${CMake_BINARY_DIR}/Testing/MumpsCoverage
  2354. $<TARGET_FILE:ctest> -T Coverage --debug)
  2355. set_tests_properties(CTestGTMCoverage PROPERTIES
  2356. PASS_REGULAR_EXPRESSION
  2357. "Process file.*ZZCOVTST.m.*Total LOC:.*30.*Percentage Coverage: 80.00*"
  2358. ENVIRONMENT COVFILE=)
  2359. configure_file(
  2360. "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/DartConfiguration.cache.tcl.in"
  2361. "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/DartConfiguration.tcl")
  2362. configure_file(
  2363. "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/cache_coverage.cmcov.in"
  2364. "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/cache_coverage.cmcov")
  2365. file(REMOVE_RECURSE "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/VistA-FOIA")
  2366. file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
  2367. DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage")
  2368. add_test(NAME CTestCacheCoverage
  2369. COMMAND cmake -E chdir
  2370. ${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage
  2371. $<TARGET_FILE:ctest> -T Coverage --debug)
  2372. set_tests_properties(CTestCacheCoverage PROPERTIES
  2373. PASS_REGULAR_EXPRESSION
  2374. "Process file.*ZZCOVTST.m.*Total LOC:.*29.*Percentage Coverage: 86.21.*"
  2375. ENVIRONMENT COVFILE=)
  2376. # Adding a test case for Python Coverage
  2377. configure_file(
  2378. "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coverage.xml.in"
  2379. "${CMake_BINARY_DIR}/Testing/PythonCoverage/coverage.xml")
  2380. configure_file(
  2381. "${CMake_SOURCE_DIR}/Tests/PythonCoverage/DartConfiguration.tcl.in"
  2382. "${CMake_BINARY_DIR}/Testing/PythonCoverage/DartConfiguration.tcl")
  2383. file(COPY "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coveragetest"
  2384. DESTINATION "${CMake_BINARY_DIR}/Testing/PythonCoverage")
  2385. add_test(NAME CTestPythonCoverage
  2386. COMMAND cmake -E chdir
  2387. ${CMake_BINARY_DIR}/Testing/PythonCoverage
  2388. $<TARGET_FILE:ctest> -T Coverage --debug)
  2389. set_tests_properties(CTestPythonCoverage PROPERTIES
  2390. PASS_REGULAR_EXPRESSION
  2391. "Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*"
  2392. ENVIRONMENT COVFILE=)
  2393. # Adding a test case for non-python Cobertura Coverage
  2394. configure_file(
  2395. "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/DartConfiguration.tcl.in"
  2396. "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/DartConfiguration.tcl")
  2397. configure_file(
  2398. "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/coverage.xml.in"
  2399. "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/coverage.xml")
  2400. file(COPY "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/src"
  2401. DESTINATION "${CMake_BINARY_DIR}/Testing/CoberturaCoverage")
  2402. add_test(NAME CTestCoberturaCoverage
  2403. COMMAND cmake -E chdir
  2404. ${CMake_BINARY_DIR}/Testing/CoberturaCoverage
  2405. $<TARGET_FILE:ctest> -T Coverage --debug)
  2406. set_tests_properties(CTestCoberturaCoverage PROPERTIES
  2407. PASS_REGULAR_EXPRESSION
  2408. "Process file.*CoverageTest.java.*Total LOC:.*18.*Percentage Coverage: 72.22.*"
  2409. ENVIRONMENT COBERTURADIR=${CMake_BINARY_DIR}/Testing/CoberturaCoverage
  2410. ENVIRONMENT COVFILE=)
  2411. # Adding a test case for JaCoCo Coverage
  2412. configure_file(
  2413. "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/DartConfiguration.tcl.in"
  2414. "${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl")
  2415. file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage"
  2416. DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage")
  2417. configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in"
  2418. "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml")
  2419. add_test(NAME CTestJacocoCoverage
  2420. COMMAND cmake -E chdir
  2421. ${CMake_BINARY_DIR}/Testing/JacocoCoverage
  2422. $<TARGET_FILE:ctest> -T Coverage --debug)
  2423. set_tests_properties(CTestJacocoCoverage PROPERTIES
  2424. PASS_REGULAR_EXPRESSION
  2425. "Process file.*CoverageTest.java.*Total LOC:.*17.*Percentage Coverage: 76.47*"
  2426. ENVIRONMENT COVFILE=)
  2427. # Adding a test case for Javascript Coverage
  2428. configure_file(
  2429. "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/DartConfiguration.tcl.in"
  2430. "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/DartConfiguration.tcl")
  2431. configure_file(
  2432. "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/output.json.in"
  2433. "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/output.json")
  2434. file(COPY "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/"
  2435. DESTINATION "${CMake_BINARY_DIR}/Testing/JavascriptCoverage"
  2436. FILES_MATCHING PATTERN "*.js")
  2437. add_test(NAME CTestJavascriptCoverage
  2438. COMMAND cmake -E chdir
  2439. ${CMake_BINARY_DIR}/Testing/JavascriptCoverage
  2440. $<TARGET_FILE:ctest> -T Coverage --debug)
  2441. set_tests_properties(CTestJavascriptCoverage PROPERTIES
  2442. PASS_REGULAR_EXPRESSION
  2443. "Process file.*test3.js.*Total LOC:.*49.*Percentage Coverage: 79.59*"
  2444. ENVIRONMENT COVFILE=)
  2445. # test coverage for Delphi-code-Coverage
  2446. configure_file(
  2447. "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/DartConfiguration.tcl.in"
  2448. "${CMake_BINARY_DIR}/Testing/DelphiCoverage/DartConfiguration.tcl")
  2449. file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/src"
  2450. DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage")
  2451. configure_file(
  2452. "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html.in"
  2453. "${CMake_BINARY_DIR}/Testing/DelphiCoverage/UTCovTest(UTCovTest.pas).html")
  2454. add_test(NAME CTestDelphiCoverage
  2455. COMMAND cmake -E chdir
  2456. ${CMake_BINARY_DIR}/Testing/DelphiCoverage
  2457. $<TARGET_FILE:ctest> -T Coverage --debug)
  2458. set_tests_properties(CTestDelphiCoverage PROPERTIES
  2459. PASS_REGULAR_EXPRESSION
  2460. "Process file.*UTCovTest.pas.*Total LOC:.*20.*Percentage Coverage: 95.*"
  2461. ENVIRONMENT COVFILE=)
  2462. function(add_config_tests cfg)
  2463. set(base "${CMake_BINARY_DIR}/Tests/CTestConfig")
  2464. # Test -S script with a -C config arg to ctest:
  2465. configure_file(
  2466. "${CMake_SOURCE_DIR}/Tests/CTestConfig/script.cmake.in"
  2467. "${base}/${cfg}-script.cmake"
  2468. @ONLY ESCAPE_QUOTES)
  2469. add_test(CTestConfig.Script.${cfg} ${CMAKE_CTEST_COMMAND}
  2470. -C ${cfg}
  2471. -S "${base}/${cfg}-script.cmake" -VV
  2472. --output-log "${base}/${cfg}-script.log"
  2473. )
  2474. # Test -D dashboard with a -C config arg to ctest.
  2475. # (Actual commands inside a cmake -P script because we need to be able to set
  2476. # the working directory reliably...)
  2477. configure_file(
  2478. "${CMake_SOURCE_DIR}/Tests/CTestConfig/dashboard.cmake.in"
  2479. "${base}/${cfg}-dashboard.cmake"
  2480. @ONLY ESCAPE_QUOTES)
  2481. add_test(CTestConfig.Dashboard.${cfg} ${CMAKE_CMAKE_COMMAND}
  2482. -P "${base}/${cfg}-dashboard.cmake" -VV
  2483. )
  2484. endfunction()
  2485. add_config_tests(Debug)
  2486. add_config_tests(MinSizeRel)
  2487. add_config_tests(Release)
  2488. add_config_tests(RelWithDebInfo)
  2489. # Test -S script with some -D variable definition args to ctest:
  2490. add_test(CTestConfig.ScriptWithArgs ${CMAKE_CTEST_COMMAND}
  2491. -C "Release"
  2492. -D arg1=this
  2493. -D arg2=that
  2494. -D "arg3=the other"
  2495. "-Darg4=this is the fourth"
  2496. -Darg5=the_fifth
  2497. -Darg6:STRING=value-with-type
  2498. -S "${CMake_SOURCE_DIR}/Tests/CTestConfig/ScriptWithArgs.cmake" -VV
  2499. --output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log"
  2500. )
  2501. ADD_TEST_MACRO(CMakeCommands.add_compile_options add_compile_options)
  2502. ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
  2503. ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
  2504. ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
  2505. ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options)
  2506. if(CMake_TEST_SERVER_MODE)
  2507. # The cmake server-mode test requires python for a simple client.
  2508. find_package(PythonInterp QUIET)
  2509. if(PYTHON_EXECUTABLE)
  2510. set(Server_BUILD_OPTIONS -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE})
  2511. ADD_TEST_MACRO(Server Server)
  2512. endif()
  2513. endif()
  2514. configure_file(
  2515. "${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"
  2516. "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake"
  2517. @ONLY ESCAPE_QUOTES)
  2518. add_test(CTestTestCrash ${CMAKE_CTEST_COMMAND}
  2519. -S "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" -V
  2520. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log"
  2521. )
  2522. # with watcom the SEGFAULT is not found, it just fails
  2523. if(CMAKE_GENERATOR MATCHES "Watcom WMake")
  2524. set_tests_properties(CTestTestCrash PROPERTIES
  2525. PASS_REGULAR_EXPRESSION "Failed")
  2526. else()
  2527. set_tests_properties(CTestTestCrash PROPERTIES
  2528. PASS_REGULAR_EXPRESSION "(Illegal|SegFault)")
  2529. endif()
  2530. configure_file(
  2531. "${CMake_SOURCE_DIR}/Tests/CTestTestBadExe/test.cmake.in"
  2532. "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake"
  2533. @ONLY ESCAPE_QUOTES)
  2534. add_test(CTestTestBadExe ${CMAKE_CTEST_COMMAND}
  2535. -S "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake" -V
  2536. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/testOutput.log"
  2537. )
  2538. set(CTestTestBadExe_REGEX "BAD_COMMAND")
  2539. # some cygwin can not be made to produce a BAD_COMMAND error
  2540. # the best we can get from it is a failed test
  2541. if(CYGWIN)
  2542. set(CTestTestBadExe_REGEX "(\\*\\*\\*Failed)|BAD_COMMAND")
  2543. endif()
  2544. set_tests_properties(CTestTestBadExe PROPERTIES
  2545. PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}")
  2546. configure_file(
  2547. "${CMake_SOURCE_DIR}/Tests/CTestTestBadGenerator/test.cmake.in"
  2548. "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake"
  2549. @ONLY ESCAPE_QUOTES)
  2550. add_test(CTestTestBadGenerator ${CMAKE_CTEST_COMMAND}
  2551. -C "\${CTestTest_CONFIG}"
  2552. -S "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake" -V
  2553. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/testOutput.log"
  2554. )
  2555. set_property(TEST CTestTestBadGenerator PROPERTY
  2556. PASS_REGULAR_EXPRESSION "could not create generator named \"Bad Generator\"")
  2557. configure_file(
  2558. "${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in"
  2559. "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake"
  2560. @ONLY ESCAPE_QUOTES)
  2561. add_test(CTestTestParallel ${CMAKE_CTEST_COMMAND}
  2562. -S "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" -V
  2563. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log"
  2564. )
  2565. configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestVerboseOutput/test.cmake.in"
  2566. "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" @ONLY ESCAPE_QUOTES)
  2567. add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND}
  2568. -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV
  2569. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/testOutput.log"
  2570. -C "\${CTestTest_CONFIG}"
  2571. )
  2572. set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION
  2573. "Environment variables:.*foo=bar.*this=that"
  2574. )
  2575. configure_file(
  2576. "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in"
  2577. "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake"
  2578. @ONLY ESCAPE_QUOTES)
  2579. add_test(CTestTestSkipReturnCode ${CMAKE_CTEST_COMMAND}
  2580. -S "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" -V
  2581. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/testOutput.log"
  2582. -C \${CTEST_CONFIGURATION_TYPE}
  2583. )
  2584. set_tests_properties(CTestTestSkipReturnCode PROPERTIES
  2585. PASS_REGULAR_EXPRESSION "CMakeV1 \\.* +Passed.*CMakeV2 \\.+\\*+Skipped")
  2586. set_property(TEST CTestTestSkipReturnCode PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
  2587. ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4
  2588. --output-on-failure -C "\${CTestTest_CONFIG}")
  2589. ADD_TEST_MACRO(CTestTestMissingDependsExe ${CMAKE_CTEST_COMMAND}
  2590. --output-on-failure -C "\${CTestTest_CONFIG}")
  2591. set_tests_properties(CTestTestMissingDependsExe PROPERTIES
  2592. PASS_REGULAR_EXPRESSION "\\*\\*\\*Not Run"
  2593. )
  2594. ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND}
  2595. --output-on-failure -C "\${CTestTest_CONFIG}")
  2596. set_property(TEST CTestTestSerialOrder PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
  2597. if(NOT BORLAND)
  2598. set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process)
  2599. add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4
  2600. --output-on-failure -C "\${CTestTest_CONFIG}")
  2601. endif()
  2602. add_test(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels)
  2603. set_tests_properties(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2")
  2604. set_tests_properties(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION
  2605. "All Labels:.* Label1.* Label2")
  2606. configure_file(
  2607. "${CMake_SOURCE_DIR}/Tests/CTestTestLabelRegExp/test.cmake.in"
  2608. "${CMake_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake"
  2609. @ONLY ESCAPE_QUOTES)
  2610. add_test(NAME CTestTestLabelRegExp
  2611. COMMAND ${CMAKE_CMAKE_COMMAND}
  2612. -DSOURCE_DIR=${CMAKE_SOURCE_DIR}/Tests/CTestTestLabelRegExp
  2613. -P ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake
  2614. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp
  2615. )
  2616. configure_file(
  2617. "${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in"
  2618. "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake"
  2619. @ONLY ESCAPE_QUOTES)
  2620. add_test(CTestTestResourceLock ${CMAKE_CTEST_COMMAND}
  2621. -S "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" -V
  2622. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/output.log"
  2623. )
  2624. configure_file(
  2625. "${CMake_SOURCE_DIR}/Tests/CTestTestScheduler/test.cmake.in"
  2626. "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake"
  2627. @ONLY ESCAPE_QUOTES)
  2628. add_test(CTestTestScheduler ${CMAKE_CTEST_COMMAND}
  2629. -S "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" -V
  2630. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/testOutput.log"
  2631. )
  2632. set_tests_properties(CTestTestScheduler PROPERTIES
  2633. PASS_REGULAR_EXPRESSION "Start 1.*Start 2.*Start 3.*Start 4.*Start 4.*Start 3.*Start 2.*Start 1"
  2634. RESOURCE_LOCK "CostData")
  2635. configure_file(
  2636. "${CMake_SOURCE_DIR}/Tests/CTestTestCostSerial/test.cmake.in"
  2637. "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/test.cmake"
  2638. @ONLY ESCAPE_QUOTES)
  2639. add_test(CTestTestCostSerial ${CMAKE_CTEST_COMMAND}
  2640. -S "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/test.cmake" -V
  2641. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCostSerial/testOutput.log"
  2642. )
  2643. set_tests_properties(CTestTestCostSerial PROPERTIES
  2644. PASS_REGULAR_EXPRESSION "Start 2.*Start 3.*Start 1.*Start 2.*Start 3.*Start 1"
  2645. RESOURCE_LOCK "CostData")
  2646. configure_file(
  2647. "${CMake_SOURCE_DIR}/Tests/CTestTestStopTime/test.cmake.in"
  2648. "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/test.cmake"
  2649. @ONLY ESCAPE_QUOTES)
  2650. configure_file(
  2651. "${CMake_SOURCE_DIR}/Tests/CTestTestStopTime/GetDate.cmake"
  2652. "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/GetDate.cmake"
  2653. COPYONLY)
  2654. add_test(CTestTestStopTime ${CMAKE_CTEST_COMMAND}
  2655. -S "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/test.cmake" -V
  2656. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestStopTime/testOutput.log"
  2657. )
  2658. set_tests_properties(CTestTestStopTime PROPERTIES
  2659. PASS_REGULAR_EXPRESSION "The stop time has been passed")
  2660. configure_file(
  2661. "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in"
  2662. "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake"
  2663. @ONLY ESCAPE_QUOTES)
  2664. add_test(CTestTestSubdir ${CMAKE_CTEST_COMMAND}
  2665. -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V
  2666. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log"
  2667. )
  2668. #make sure all 3 subdirs were added
  2669. set_tests_properties(CTestTestSubdir PROPERTIES
  2670. PASS_REGULAR_EXPRESSION "0 tests failed out of 3")
  2671. configure_file(
  2672. "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
  2673. "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake"
  2674. @ONLY ESCAPE_QUOTES)
  2675. add_test(CTestTestTimeout ${CMAKE_CTEST_COMMAND}
  2676. -C "\${CTestTest_CONFIG}"
  2677. -S "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" -V
  2678. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log"
  2679. )
  2680. set_tests_properties(CTestTestTimeout PROPERTIES
  2681. PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*TestSleep *\\.+ *Passed.*timeout correctly killed child")
  2682. add_test(
  2683. NAME CTestTestRerunFailed
  2684. COMMAND ${CMAKE_CTEST_COMMAND} --rerun-failed)
  2685. set_tests_properties(CTestTestRerunFailed PROPERTIES
  2686. PASS_REGULAR_EXPRESSION "1/1 Test #1: TestTimeout" DEPENDS CTestTestTimeout
  2687. WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout)
  2688. configure_file(
  2689. "${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in"
  2690. "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake"
  2691. @ONLY ESCAPE_QUOTES)
  2692. add_test(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND}
  2693. -S "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" -V
  2694. --output-log
  2695. "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/testOutput.log")
  2696. set_tests_properties(CTestTestZeroTimeout PROPERTIES
  2697. FAIL_REGULAR_EXPRESSION "\\*\\*\\*Timeout")
  2698. configure_file(
  2699. "${CMake_SOURCE_DIR}/Tests/CTestTestDepends/test.cmake.in"
  2700. "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake"
  2701. @ONLY ESCAPE_QUOTES)
  2702. add_test(CTestTestDepends ${CMAKE_CTEST_COMMAND}
  2703. -C "\${CTestTest_CONFIG}"
  2704. -S "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake" -V
  2705. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestDepends/testOutput.log"
  2706. )
  2707. configure_file(
  2708. "${CMake_SOURCE_DIR}/Tests/CTestTestCycle/test.cmake.in"
  2709. "${CMake_BINARY_DIR}/Tests/CTestTestCycle/test.cmake"
  2710. @ONLY ESCAPE_QUOTES)
  2711. add_test(CTestTestCycle ${CMAKE_CTEST_COMMAND}
  2712. -C "\${CTestTest_CONFIG}"
  2713. -S "${CMake_BINARY_DIR}/Tests/CTestTestCycle/test.cmake" -V
  2714. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCycle/testOutput.log"
  2715. )
  2716. set_tests_properties(CTestTestCycle PROPERTIES
  2717. PASS_REGULAR_EXPRESSION "a cycle exists in the test dependency graph")
  2718. configure_file(
  2719. "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake.in"
  2720. "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake"
  2721. @ONLY ESCAPE_QUOTES)
  2722. configure_file(
  2723. "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake.in"
  2724. "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/hello.cmake"
  2725. @ONLY ESCAPE_QUOTES)
  2726. add_test(CTestTestRunScript ${CMAKE_CTEST_COMMAND}
  2727. -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V
  2728. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log"
  2729. )
  2730. add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
  2731. add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B)
  2732. configure_file(
  2733. "${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in"
  2734. "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake"
  2735. @ONLY ESCAPE_QUOTES)
  2736. add_test(CTestTestFdSetSize ${CMAKE_CTEST_COMMAND}
  2737. -S "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" -j20 -V --timeout 120
  2738. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
  2739. )
  2740. if (CMAKE_TESTS_CDASH_SERVER)
  2741. set(regex "^([^:]+)://([^/]+)(.*)$")
  2742. if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}")
  2743. set(protocol "${CMAKE_MATCH_1}")
  2744. set(server "${CMAKE_MATCH_2}")
  2745. set(path "${CMAKE_MATCH_3}")
  2746. else ()
  2747. set(protocol "http")
  2748. set(server "open.cdash.org")
  2749. set(path "")
  2750. message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...")
  2751. message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]")
  2752. endif ()
  2753. endif ()
  2754. if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER)
  2755. configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
  2756. "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
  2757. add_test(CTestTest ${CMAKE_CTEST_COMMAND}
  2758. -S "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" -V
  2759. --output-log "${CMake_BINARY_DIR}/Tests/CTestTest/testOutput.log"
  2760. )
  2761. configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest2/test.cmake.in"
  2762. "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" @ONLY ESCAPE_QUOTES)
  2763. add_test(CTestTest2 ${CMAKE_CTEST_COMMAND}
  2764. -S "${CMake_BINARY_DIR}/Tests/CTestTest2/test.cmake" -V
  2765. --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
  2766. )
  2767. if("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_GENERATOR}" MATCHES "Ninja")
  2768. configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in"
  2769. "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES)
  2770. add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND}
  2771. -S "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" -V
  2772. --output-log "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/testOutput.log"
  2773. )
  2774. set_tests_properties(CTestTestLaunchers PROPERTIES
  2775. PASS_REGULAR_EXPRESSION "CTEST_TEST_LAUNCHER_SUCCESS")
  2776. endif()
  2777. configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in"
  2778. "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY
  2779. ESCAPE_QUOTES)
  2780. add_test(CTestTestChecksum ${CMAKE_CTEST_COMMAND}
  2781. -S "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" -V
  2782. --output-log
  2783. "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/testOutput.log"
  2784. )
  2785. set_tests_properties(CTestTestChecksum PROPERTIES PASS_REGULAR_EXPRESSION
  2786. "Submission failed: Checksum failed for file")
  2787. # these tests take a long time, make sure they have it
  2788. # if timeouts have not already been set
  2789. get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT)
  2790. if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  2791. set_tests_properties ( CTestTest
  2792. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  2793. endif ()
  2794. get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT)
  2795. if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  2796. set_tests_properties ( CTestTest2
  2797. PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
  2798. endif ()
  2799. endif ()
  2800. if("${CMAKE_GENERATOR}" MATCHES Xcode)
  2801. set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
  2802. endif()
  2803. if(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt")
  2804. # If there is CMakeLists.txt in the binary tree, assume in-source build
  2805. set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
  2806. endif()
  2807. set(bootstrap "")
  2808. if(CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST)
  2809. if(UNIX)
  2810. set(bootstrap ${CMake_SOURCE_DIR}/bootstrap)
  2811. elseif(MSYS)
  2812. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap.bat.in
  2813. ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat @ONLY)
  2814. set(bootstrap ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat)
  2815. endif()
  2816. endif()
  2817. if(bootstrap)
  2818. add_test(NAME BootstrapTest
  2819. COMMAND ${CMAKE_CMAKE_COMMAND}
  2820. -D "bootstrap=${bootstrap}"
  2821. -D "bin_dir=${CMake_BINARY_DIR}/Tests/BootstrapTest"
  2822. -P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake
  2823. )
  2824. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
  2825. # This test will use all processors.
  2826. set_tests_properties(BootstrapTest PROPERTIES RUN_SERIAL 1)
  2827. # provide more time for the bootstrap test
  2828. get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT)
  2829. if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
  2830. set_tests_properties ( BootstrapTest
  2831. PROPERTIES TIMEOUT 5400)
  2832. endif ()
  2833. endif()
  2834. if(CMAKE_Fortran_COMPILER)
  2835. add_test(Fortran ${CMAKE_CTEST_COMMAND}
  2836. --build-and-test
  2837. "${CMake_SOURCE_DIR}/Tests/Fortran"
  2838. "${CMake_BINARY_DIR}/Tests/Fortran"
  2839. ${build_generator_args}
  2840. --build-project testf
  2841. --build-two-config
  2842. --build-options ${build_options}
  2843. --test-command testf)
  2844. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
  2845. if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
  2846. add_test(FortranModules ${CMAKE_CTEST_COMMAND}
  2847. --build-and-test
  2848. "${CMake_SOURCE_DIR}/Tests/FortranModules"
  2849. "${CMake_BINARY_DIR}/Tests/FortranModules"
  2850. ${build_generator_args}
  2851. --build-project FortranModules
  2852. --build-options ${build_options}
  2853. -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
  2854. -DCMake_TEST_Fortran_SUBMODULES:BOOL=${CMake_TEST_Fortran_SUBMODULES}
  2855. )
  2856. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranModules")
  2857. endif()
  2858. # FortranCInterface tests.
  2859. if(UNIX)
  2860. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FortranC/Flags.cmake.in
  2861. ${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake @ONLY)
  2862. add_test(FortranC.Flags ${CMAKE_CMAKE_COMMAND} -P
  2863. ${CMAKE_CURRENT_BINARY_DIR}/FortranC/Flags.cmake)
  2864. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC/Flags")
  2865. else()
  2866. add_test(FortranC ${CMAKE_CTEST_COMMAND}
  2867. --build-and-test
  2868. "${CMake_SOURCE_DIR}/Tests/FortranC"
  2869. "${CMake_BINARY_DIR}/Tests/FortranC"
  2870. ${build_generator_args}
  2871. --build-project FortranC
  2872. --build-two-config
  2873. --build-options ${build_options}
  2874. --test-command CMakeFiles/FortranCInterface/FortranCInterface)
  2875. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/FortranC")
  2876. endif()
  2877. endif()
  2878. find_package(Java COMPONENTS Development QUIET)
  2879. if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW
  2880. AND NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
  2881. set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
  2882. ADD_TEST_MACRO(JavaExportImport JavaExportImport)
  2883. get_filename_component(JNIPATH ${JAVA_COMPILE} PATH)
  2884. find_file(JNI_H jni.h
  2885. "${JNIPATH}/../include"
  2886. "${JNIPATH}/../java/include")
  2887. if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
  2888. file(READ "${JNI_H}" JNI_FILE)
  2889. if("${JNI_FILE}" MATCHES "JDK1_2")
  2890. add_test(Java.Jar ${CMAKE_CTEST_COMMAND}
  2891. --build-and-test
  2892. "${CMake_SOURCE_DIR}/Tests/Java"
  2893. "${CMake_BINARY_DIR}/Tests/JavaJar"
  2894. ${build_generator_args}
  2895. --build-project hello
  2896. --build-target hello
  2897. --build-two-config
  2898. --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/"
  2899. --build-options ${build_options}
  2900. --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
  2901. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar")
  2902. add_test(Java.JarSourceList ${CMAKE_CTEST_COMMAND}
  2903. --build-and-test
  2904. "${CMake_SOURCE_DIR}/Tests/Java"
  2905. "${CMake_BINARY_DIR}/Tests/JavaJarSourceList"
  2906. ${build_generator_args}
  2907. --build-project hello
  2908. --build-target hello2
  2909. --build-two-config
  2910. --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceList/"
  2911. --build-options ${build_options}
  2912. --test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
  2913. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
  2914. # For next test, java tool must have same architecture as toolchain
  2915. math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
  2916. execute_process(
  2917. COMMAND "${Java_JAVA_EXECUTABLE}" -d${_object_mode} -version
  2918. OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result
  2919. )
  2920. if(_result EQUAL 0)
  2921. if(CMAKE_CONFIGURATION_TYPES)
  2922. set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
  2923. else()
  2924. set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
  2925. endif()
  2926. add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND}
  2927. --build-and-test
  2928. "${CMake_SOURCE_DIR}/Tests/JavaJavah"
  2929. "${CMake_BINARY_DIR}/Tests/JavaJavah"
  2930. ${build_generator_args}
  2931. --build-project helloJavah
  2932. --build-two-config
  2933. --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
  2934. --build-options ${build_options}
  2935. --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2)
  2936. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
  2937. endif()
  2938. endif()
  2939. endif()
  2940. endif()
  2941. # add some cross compiler tests, for now only with makefile based generators
  2942. if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "KDevelop")
  2943. # if sdcc is found, build the SimpleCOnly project with sdcc
  2944. find_program(SDCC_EXECUTABLE sdcc)
  2945. mark_as_advanced(SDCC_EXECUTABLE)
  2946. if(SDCC_EXECUTABLE)
  2947. add_test(SimpleCOnly_sdcc ${CMAKE_CTEST_COMMAND}
  2948. --build-and-test
  2949. "${CMake_SOURCE_DIR}/Tests/SimpleCOnly"
  2950. "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc"
  2951. ${build_generator_args}
  2952. --build-project SimpleC
  2953. --build-options ${build_options}
  2954. "-DCMAKE_SYSTEM_NAME=Generic"
  2955. "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}")
  2956. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc")
  2957. endif()
  2958. # If a Linux -> MinGW cross compiler is found then try it
  2959. find_program(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc)
  2960. find_program(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++)
  2961. find_program(MINGW_RC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-windres)
  2962. mark_as_advanced(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE MINGW_RC_LINUX2WIN_EXECUTABLE)
  2963. if(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE AND MINGW_RC_LINUX2WIN_EXECUTABLE)
  2964. add_test(Simple_Mingw_Linux2Win ${CMAKE_CTEST_COMMAND}
  2965. --build-and-test
  2966. "${CMake_SOURCE_DIR}/Tests/Simple"
  2967. "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win"
  2968. ${build_generator_args}
  2969. --build-project Simple
  2970. --build-options ${build_options}
  2971. "-DCMAKE_SYSTEM_NAME=Windows"
  2972. "-DCMAKE_C_COMPILER=${MINGW_CC_LINUX2WIN_EXECUTABLE}"
  2973. "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}"
  2974. "-DCMAKE_RC_COMPILER=${MINGW_RC_LINUX2WIN_EXECUTABLE}"
  2975. )
  2976. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win")
  2977. endif()
  2978. endif()
  2979. if(CMAKE_TEST_PROJECT_CSE_DIR)
  2980. set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/BuildProjectCSE.cmake")
  2981. if(NOT EXISTS "${script}")
  2982. set(script "${CMAKE_TEST_PROJECT_CSE_DIR}/cse_build.cmake")
  2983. endif()
  2984. if(NOT EXISTS "${script}")
  2985. message("warning: CMAKE_TEST_PROJECT_CSE_DIR set, but no build script found...")
  2986. endif()
  2987. add_test(BuildCSE ${CMAKE_CTEST_COMMAND} -V -S "${script}")
  2988. set_tests_properties(BuildCSE PROPERTIES TIMEOUT 5400)
  2989. endif()
  2990. if(CMAKE_TEST_PLPLOT_DIR)
  2991. add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake )
  2992. set_tests_properties ( plplot PROPERTIES TIMEOUT 5400)
  2993. endif()
  2994. if(CMAKE_TEST_CHICKEN_DIR)
  2995. add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake )
  2996. set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400)
  2997. endif()
  2998. if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR)
  2999. add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake )
  3000. set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400)
  3001. endif()
  3002. # If this is not an in-source build, provide a target to wipe out
  3003. # all the test build directories.
  3004. if(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt")
  3005. configure_file(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in
  3006. ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY)
  3007. add_custom_target(test_clean
  3008. COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake
  3009. COMMENT "Removing test build directories."
  3010. )
  3011. endif()
  3012. add_test(NAME CMakeWizardTest COMMAND cmake -i)
  3013. set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION
  3014. "The \"cmake -i\" wizard mode is no longer supported.")
  3015. # If the cache variable CMAKE_CONTRACT_PROJECTS is set
  3016. # then the dashboard will run a contract with CMake test of that
  3017. # name. For example CMAKE_CONTRACT_PROJECTS = vtk542 would run
  3018. # the vtk542 contract test.
  3019. # For each Contract test, the project should provide a directory
  3020. # with at least one CMakeLists.txt file that uses ExternalProject
  3021. # to download and configure the project. The directory should also
  3022. # contain a RunTest.cmake file that has a single set of the format:
  3023. # set(project_RUN_TEST testToRun)
  3024. # The testToRun should be a test executable that can be run to
  3025. # smoke test the build.
  3026. foreach(project ${CMAKE_CONTRACT_PROJECTS})
  3027. include(Contracts/${project}/RunTest.cmake)
  3028. ADD_TEST_MACRO(Contracts.${project}
  3029. ${${project}_RUN_TEST})
  3030. # Contract test timeout in seconds.
  3031. # Default to 6 hours.
  3032. if(DEFINED ${project}_TEST_TIMEOUT)
  3033. set(timeout ${${project}_TEST_TIMEOUT})
  3034. elseif(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT)
  3035. set(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT})
  3036. else()
  3037. set(timeout 21600)
  3038. endif()
  3039. set_tests_properties(Contracts.${project} PROPERTIES TIMEOUT ${timeout})
  3040. endforeach()
  3041. if(TEST_CompileCommandOutput)
  3042. set(CompileCommandOutput_BUILD_OPTIONS
  3043. -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})
  3044. ADD_TEST_MACRO(CompileCommandOutput
  3045. "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
  3046. endif()
  3047. add_test(IncludeDirectories ${CMAKE_CTEST_COMMAND}
  3048. --build-and-test
  3049. "${CMake_SOURCE_DIR}/Tests/IncludeDirectories"
  3050. "${CMake_BINARY_DIR}/Tests/IncludeDirectories"
  3051. --build-two-config
  3052. ${build_generator_args}
  3053. --build-project IncludeDirectories
  3054. --build-options ${build_options}
  3055. --test-command IncludeDirectories)
  3056. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories")
  3057. add_test(InterfaceLinkLibraries ${CMAKE_CTEST_COMMAND}
  3058. --build-and-test
  3059. "${CMake_SOURCE_DIR}/Tests/InterfaceLinkLibraries"
  3060. "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries"
  3061. --build-two-config
  3062. ${build_generator_args}
  3063. --build-project InterfaceLinkLibraries
  3064. --build-options ${build_options}
  3065. --test-command InterfaceLinkLibraries)
  3066. list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceLinkLibraries")
  3067. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  3068. add_subdirectory(CMakeTests)
  3069. endif()
  3070. endif()