CMakeLists.txt 128 KB

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