CMakeLists.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. # See adjacent README.rst for documentation of this test infrastructure.
  2. # Note that the _isMultiConfig variable is set in the parent directory's
  3. # CMakeLists.txt (slightly complex logic to support CMake versions before 3.9)
  4. macro(add_RunCMake_test test)
  5. set(TEST_ARGS ${ARGN})
  6. if ("${ARGV1}" STREQUAL "TEST_DIR")
  7. if ("${ARGV2}" STREQUAL "")
  8. message(FATAL_ERROR "Invalid args")
  9. endif()
  10. set(Test_Dir ${ARGV2})
  11. list(REMOVE_AT TEST_ARGS 0)
  12. list(REMOVE_AT TEST_ARGS 0)
  13. else()
  14. set(Test_Dir ${test})
  15. endif()
  16. add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
  17. -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
  18. -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig}
  19. -DRunCMake_GENERATOR=${CMAKE_GENERATOR}
  20. -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}
  21. -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
  22. -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
  23. -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
  24. -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}
  25. -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
  26. ${${test}_ARGS}
  27. ${TEST_ARGS}
  28. -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake"
  29. )
  30. endmacro()
  31. function(add_RunCMake_test_group test types)
  32. # create directory for common content
  33. set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf")
  34. file(REMOVE_RECURSE "${TEST_CONFIG_DIR}")
  35. file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}")
  36. foreach(type IN LISTS types)
  37. # generate prerequirements config file in cmake as ctest doesn't have as
  38. # much system information so it is easier to set programs and environment
  39. # values here
  40. unset(${test}_${type}_FOUND_PREREQUIREMENTS)
  41. include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake")
  42. get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS"
  43. "${TEST_CONFIG_DIR}/${type}_config.cmake")
  44. # only add the test if prerequirements are met
  45. if(${test}_${type}_FOUND_PREREQUIREMENTS)
  46. add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND}
  47. -DTEST_TYPE=${type}
  48. -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
  49. -DRunCMake_GENERATOR_IS_MULTI_CONFIG=${_isMultiConfig}
  50. -DRunCMake_GENERATOR=${CMAKE_GENERATOR}
  51. -DRunCMake_GENERATOR_INSTANCE=${CMAKE_GENERATOR_INSTANCE}
  52. -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
  53. -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
  54. -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
  55. -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
  56. -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test}
  57. -Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake
  58. -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
  59. )
  60. endif()
  61. endforeach()
  62. endfunction()
  63. if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
  64. set(Swift_ARGS -DXCODE_BELOW_6_1=1)
  65. endif()
  66. # Test MSVC for older host CMake versions, and test
  67. # WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
  68. if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
  69. set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1)
  70. endif()
  71. add_RunCMake_test(CMP0019)
  72. add_RunCMake_test(CMP0022)
  73. add_RunCMake_test(CMP0026)
  74. add_RunCMake_test(CMP0027)
  75. add_RunCMake_test(CMP0028)
  76. add_RunCMake_test(CMP0037)
  77. add_RunCMake_test(CMP0038)
  78. add_RunCMake_test(CMP0039)
  79. add_RunCMake_test(CMP0040)
  80. add_RunCMake_test(CMP0041)
  81. if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
  82. add_RunCMake_test(CMP0042)
  83. endif()
  84. add_RunCMake_test(CMP0043)
  85. add_RunCMake_test(CMP0045)
  86. add_RunCMake_test(CMP0046)
  87. add_RunCMake_test(CMP0049)
  88. add_RunCMake_test(CMP0050)
  89. add_RunCMake_test(CMP0051)
  90. add_RunCMake_test(CMP0053)
  91. add_RunCMake_test(CMP0054)
  92. add_RunCMake_test(CMP0055)
  93. add_RunCMake_test(CMP0057)
  94. add_RunCMake_test(CMP0059)
  95. add_RunCMake_test(CMP0060)
  96. add_RunCMake_test(CMP0064)
  97. if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
  98. add_RunCMake_test(CMP0068)
  99. endif()
  100. add_RunCMake_test(CMP0069)
  101. # The test for Policy 65 requires the use of the
  102. # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
  103. # generators ignore. The policy will have no effect on those generators.
  104. if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
  105. add_RunCMake_test(CMP0065)
  106. endif()
  107. if(CMAKE_GENERATOR MATCHES "Make")
  108. add_RunCMake_test(Make)
  109. endif()
  110. if(CMAKE_GENERATOR STREQUAL "Ninja")
  111. set(Ninja_ARGS
  112. -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION}
  113. -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
  114. -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX})
  115. add_RunCMake_test(Ninja)
  116. endif()
  117. add_RunCMake_test(CTest)
  118. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  119. add_RunCMake_test(ctest_memcheck
  120. -DPSEUDO_BC=$<TARGET_FILE:pseudo_BC>
  121. -DPSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify>
  122. -DPSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind>
  123. -DPSEUDO_BC_NOLOG=$<TARGET_FILE:pseudonl_BC>
  124. -DPSEUDO_PURIFY_NOLOG=$<TARGET_FILE:pseudonl_purify>
  125. -DPSEUDO_VALGRIND_NOLOG=$<TARGET_FILE:pseudonl_valgrind>
  126. -DMEMCHECK_FAIL=$<TARGET_FILE:memcheck_fail>
  127. )
  128. endif()
  129. add_RunCMake_test(AndroidTestUtilities)
  130. add_RunCMake_test(BuildDepends)
  131. if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
  132. add_RunCMake_test(CompilerChange)
  133. endif()
  134. add_RunCMake_test(CompilerNotFound)
  135. add_RunCMake_test(Configure)
  136. add_RunCMake_test(DisallowedCommands)
  137. add_RunCMake_test(ExternalData)
  138. add_RunCMake_test(FeatureSummary)
  139. add_RunCMake_test(FPHSA)
  140. add_RunCMake_test(FindBoost)
  141. add_RunCMake_test(FindOpenGL)
  142. if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
  143. add_RunCMake_test(GenerateExportHeader)
  144. endif()
  145. add_RunCMake_test(GeneratorExpression)
  146. add_RunCMake_test(GeneratorInstance)
  147. add_RunCMake_test(GeneratorPlatform)
  148. add_RunCMake_test(GeneratorToolset)
  149. add_RunCMake_test(GetPrerequisites)
  150. add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
  151. add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test
  152. add_RunCMake_test(TargetPropertyGeneratorExpressions)
  153. add_RunCMake_test(Languages)
  154. add_RunCMake_test(LinkStatic)
  155. add_RunCMake_test(ObjectLibrary)
  156. if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
  157. add_RunCMake_test(RuntimePath)
  158. endif()
  159. add_RunCMake_test(Swift)
  160. add_RunCMake_test(TargetObjects)
  161. add_RunCMake_test(TargetSources)
  162. add_RunCMake_test(ToolchainFile)
  163. add_RunCMake_test(find_dependency)
  164. add_RunCMake_test(CompileDefinitions)
  165. add_RunCMake_test(CompileFeatures)
  166. add_RunCMake_test(PolicyScope)
  167. add_RunCMake_test(WriteCompilerDetectionHeader)
  168. add_RunCMake_test(SourceProperties)
  169. if(NOT WIN32)
  170. add_RunCMake_test(PositionIndependentCode)
  171. endif()
  172. if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
  173. add_RunCMake_test(VisibilityPreset)
  174. endif()
  175. if (QT4_FOUND)
  176. set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
  177. endif()
  178. add_RunCMake_test(CompatibleInterface)
  179. add_RunCMake_test(Syntax)
  180. add_RunCMake_test(add_custom_command)
  181. add_RunCMake_test(add_custom_target)
  182. add_RunCMake_test(add_dependencies)
  183. add_RunCMake_test(add_executable)
  184. add_RunCMake_test(add_library)
  185. add_RunCMake_test(add_subdirectory)
  186. add_RunCMake_test(build_command)
  187. add_executable(exit_code exit_code.c)
  188. set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)
  189. if(NOT CMake_TEST_EXTERNAL_CMAKE)
  190. list(APPEND execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>)
  191. endif()
  192. add_RunCMake_test(execute_process)
  193. add_RunCMake_test(export)
  194. add_RunCMake_test(cmake_minimum_required)
  195. add_RunCMake_test(cmake_parse_arguments)
  196. add_RunCMake_test(continue)
  197. add_RunCMake_test(ctest_build)
  198. add_RunCMake_test(ctest_cmake_error)
  199. add_RunCMake_test(ctest_configure)
  200. if(COVERAGE_COMMAND)
  201. add_RunCMake_test(ctest_coverage -DCOVERAGE_COMMAND=${COVERAGE_COMMAND})
  202. endif()
  203. add_RunCMake_test(ctest_start)
  204. add_RunCMake_test(ctest_submit)
  205. add_RunCMake_test(ctest_test)
  206. add_RunCMake_test(ctest_disabled_test)
  207. add_RunCMake_test(ctest_skipped_test)
  208. add_RunCMake_test(ctest_upload)
  209. add_RunCMake_test(ctest_fixtures)
  210. add_RunCMake_test(file)
  211. add_RunCMake_test(find_file)
  212. add_RunCMake_test(find_library)
  213. add_RunCMake_test(find_package)
  214. add_RunCMake_test(find_path)
  215. add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
  216. add_RunCMake_test(foreach)
  217. add_RunCMake_test(get_filename_component)
  218. add_RunCMake_test(get_property)
  219. add_RunCMake_test(if)
  220. add_RunCMake_test(include)
  221. add_RunCMake_test(include_directories)
  222. add_RunCMake_test(include_guard)
  223. add_RunCMake_test(list)
  224. add_RunCMake_test(message)
  225. add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
  226. add_RunCMake_test(return)
  227. add_RunCMake_test(separate_arguments)
  228. add_RunCMake_test(set_property)
  229. add_RunCMake_test(string)
  230. add_RunCMake_test(test_include_dirs)
  231. function(add_RunCMake_test_try_compile)
  232. if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
  233. # Older CMake versions do not know about MSVC language standards.
  234. # Approximate our logic from MSVC-CXX.cmake.
  235. if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
  236. CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR
  237. CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017)
  238. set(CMAKE_CXX_STANDARD_DEFAULT 14)
  239. elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
  240. set(CMAKE_CXX_STANDARD_DEFAULT "")
  241. else()
  242. unset(CMAKE_CXX_STANDARD_DEFAULT)
  243. endif()
  244. endif()
  245. foreach(var
  246. CMAKE_C_COMPILER_ID
  247. CMAKE_C_COMPILER_VERSION
  248. CMAKE_C_STANDARD_DEFAULT
  249. CMAKE_CXX_COMPILER_ID
  250. CMAKE_CXX_COMPILER_VERSION
  251. CMAKE_CXX_STANDARD_DEFAULT
  252. CMake_TEST_CUDA
  253. )
  254. if(DEFINED ${var})
  255. list(APPEND try_compile_ARGS -D${var}=${${var}})
  256. endif()
  257. endforeach()
  258. add_RunCMake_test(try_compile)
  259. endfunction()
  260. add_RunCMake_test_try_compile()
  261. add_RunCMake_test(try_run)
  262. add_RunCMake_test(set)
  263. add_RunCMake_test(variable_watch)
  264. add_RunCMake_test(while)
  265. add_RunCMake_test(CMP0004)
  266. add_RunCMake_test(TargetPolicies)
  267. add_RunCMake_test(alias_targets)
  268. add_RunCMake_test(interface_library)
  269. add_RunCMake_test(no_install_prefix)
  270. add_RunCMake_test(configure_file)
  271. add_RunCMake_test(CTestTimeoutAfterMatch)
  272. find_package(Qt4 QUIET)
  273. find_package(Qt5Core QUIET)
  274. if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
  275. add_RunCMake_test(IncompatibleQt)
  276. endif()
  277. if (QT4_FOUND)
  278. add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
  279. endif()
  280. find_package(PkgConfig QUIET)
  281. if(PKG_CONFIG_FOUND)
  282. add_RunCMake_test(FindPkgConfig)
  283. endif()
  284. find_package(GTK2 QUIET)
  285. if (GTK2_FOUND)
  286. add_RunCMake_test(FindGTK2)
  287. endif()
  288. if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
  289. add_RunCMake_test(include_external_msproject)
  290. if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([89]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND)
  291. set(NO_USE_FOLDERS 1)
  292. endif()
  293. add_RunCMake_test(VSSolution -DNO_USE_FOLDERS=${NO_USE_FOLDERS})
  294. endif()
  295. if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])")
  296. add_RunCMake_test(VS10Project)
  297. endif()
  298. if(XCODE_VERSION)
  299. add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
  300. endif()
  301. if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
  302. AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
  303. add_RunCMake_test(Framework)
  304. endif()
  305. add_RunCMake_test(File_Generate)
  306. add_RunCMake_test(ExportWithoutLanguage)
  307. add_RunCMake_test(target_link_libraries)
  308. add_RunCMake_test(target_compile_features)
  309. add_RunCMake_test(CheckModules)
  310. add_RunCMake_test(CheckIPOSupported)
  311. add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
  312. add_RunCMake_test(CommandLineTar)
  313. add_RunCMake_test(install)
  314. add_RunCMake_test(CPackConfig)
  315. add_RunCMake_test(CPackInstallProperties)
  316. add_RunCMake_test(ExternalProject)
  317. add_RunCMake_test(FetchContent)
  318. add_RunCMake_test(CTestCommandLine)
  319. add_RunCMake_test(CacheNewline)
  320. # Only run this test on unix platforms that support
  321. # symbolic links
  322. if(UNIX)
  323. add_RunCMake_test(CPackSymlinks)
  324. endif()
  325. set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
  326. add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
  327. set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES)
  328. add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths)
  329. # Matlab module related tests
  330. if(CMake_TEST_FindMatlab)
  331. add_RunCMake_test(FindMatlab)
  332. endif()
  333. add_executable(pseudo_emulator pseudo_emulator.c)
  334. add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c)
  335. add_RunCMake_test(CrosscompilingEmulator
  336. -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>
  337. -DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>)
  338. if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
  339. if(UNIX AND NOT CYGWIN)
  340. execute_process(COMMAND ldd --help
  341. OUTPUT_VARIABLE LDD_HELP
  342. ERROR_VARIABLE LDD_ERR)
  343. if("${LDD_HELP}" MATCHES
  344. "(-r, --function-relocs.*process data and function relocations.*-u, --unused.*print unused direct dependencies)")
  345. add_RunCMake_test(LinkWhatYouUse)
  346. endif()
  347. endif()
  348. add_executable(pseudo_tidy pseudo_tidy.c)
  349. add_executable(pseudo_iwyu pseudo_iwyu.c)
  350. add_executable(pseudo_cpplint pseudo_cpplint.c)
  351. add_executable(pseudo_cppcheck pseudo_cppcheck.c)
  352. add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>)
  353. add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>)
  354. add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>)
  355. add_RunCMake_test(Cppcheck -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>)
  356. add_RunCMake_test(MultiLint
  357. -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>
  358. -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>
  359. -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>
  360. -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>
  361. )
  362. if(DEFINED CMake_TEST_CUDA)
  363. list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
  364. endif()
  365. if(CMAKE_Fortran_COMPILER)
  366. list(APPEND CompilerLauncher_ARGS -DCMake_TEST_Fortran=1)
  367. endif()
  368. add_RunCMake_test(CompilerLauncher)
  369. add_RunCMake_test(ctest_labels_for_subprojects)
  370. endif()
  371. add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ")
  372. # add a test to make sure symbols are exported from a shared library
  373. # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
  374. add_RunCMake_test(AutoExportDll)
  375. add_RunCMake_test(AndroidMK)
  376. if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN)
  377. if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
  378. message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators")
  379. endif()
  380. foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
  381. if(CMake_${v})
  382. string(REPLACE ";" "|" ${v} "${CMake_${v}}")
  383. list(APPEND Android_ARGS "-D${v}=${${v}}")
  384. endif()
  385. endforeach()
  386. add_RunCMake_test(Android)
  387. # This test can take a very long time due to lots of combinations.
  388. # Use a long default timeout and provide an option to customize it.
  389. if(NOT DEFINED CMake_TEST_ANDROID_TIMEOUT)
  390. set(CMake_TEST_ANDROID_TIMEOUT 3000)
  391. endif()
  392. set_property(TEST RunCMake.Android PROPERTY TIMEOUT ${CMake_TEST_ANDROID_TIMEOUT})
  393. endif()
  394. if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])")
  395. add_RunCMake_test(CSharpCustomCommand)
  396. endif()