CMakeLists.txt 131 KB

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