RunCMakeTest.cmake 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. cmake_minimum_required(VERSION 3.1)
  2. include(RunCMake)
  3. run_cmake_command(NoArgs ${CMAKE_COMMAND})
  4. run_cmake_command(InvalidArg1 ${CMAKE_COMMAND} -invalid)
  5. run_cmake_command(InvalidArg2 ${CMAKE_COMMAND} --invalid)
  6. run_cmake_command(Wizard ${CMAKE_COMMAND} -i)
  7. run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C)
  8. run_cmake_command(C-no-arg2 ${CMAKE_COMMAND} -B DummyBuildDir -C -T)
  9. set(RunCMake_TEST_RAW_ARGS [[-C ""]])
  10. run_cmake_command(C-no-arg3 ${CMAKE_COMMAND} -B DummyBuildDir)
  11. unset(RunCMake_TEST_RAW_ARGS)
  12. run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt)
  13. run_cmake_command(Cno-file ${CMAKE_COMMAND} -B DummyBuildDir -Cnosuchcachefile.txt)
  14. run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt)
  15. run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt)
  16. run_cmake_command(D-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -D)
  17. run_cmake_command(D-no-src ${CMAKE_COMMAND} -B DummyBuildDir -D VAR=VALUE)
  18. run_cmake_command(Dno-src ${CMAKE_COMMAND} -B DummyBuildDir -DVAR=VALUE)
  19. run_cmake_command(U-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -U)
  20. run_cmake_command(U-no-src ${CMAKE_COMMAND} -B DummyBuildDir -U VAR)
  21. run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR)
  22. run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E)
  23. run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities)
  24. run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg)
  25. run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_files ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf)
  26. run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf)
  27. run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2)
  28. run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b)
  29. run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt)
  30. run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append)
  31. run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename)
  32. run_cmake_command(E_server ${CMAKE_COMMAND} -E server)
  33. run_cmake_command(E_true ${CMAKE_COMMAND} -E true)
  34. run_cmake_command(E_true-extraargs ${CMAKE_COMMAND} -E true ignored)
  35. run_cmake_command(E_false ${CMAKE_COMMAND} -E false)
  36. run_cmake_command(E_false-extraargs ${CMAKE_COMMAND} -E false ignored)
  37. run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate)
  38. run_cmake_command(E_touch-nonexistent-dir ${CMAKE_COMMAND} -E touch "${RunCMake_BINARY_DIR}/touch-nonexistent-dir/foo")
  39. run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world")
  40. run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time)
  41. run_cmake_command(E___run_co_compile-no-iwyu ${CMAKE_COMMAND} -E __run_co_compile -- command-does-not-exist)
  42. run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist -- command-does-not-exist)
  43. run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist)
  44. run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --)
  45. run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G)
  46. run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator)
  47. run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P)
  48. run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake)
  49. run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B)
  50. run_cmake_command(build-no-dir
  51. ${CMAKE_COMMAND} --build)
  52. run_cmake_command(build-no-cache
  53. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
  54. run_cmake_command(build-unknown-command-short
  55. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} -invalid-command)
  56. run_cmake_command(build-unknown-command-long
  57. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --invalid-command)
  58. run_cmake_command(build-unknown-command-partial-match
  59. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --targetinvalid)
  60. run_cmake_command(build-invalid-target-syntax
  61. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --target=invalid)
  62. run_cmake_command(build-no-generator
  63. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
  64. run_cmake_command(build-bad-dir
  65. ${CMAKE_COMMAND} --build dir-does-not-exist)
  66. run_cmake_command(build-bad-generator
  67. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
  68. run_cmake_command(install-prefix-no-arg ${CMAKE_COMMAND} -B DummyBuildDir --install-prefix)
  69. run_cmake_command(install-no-dir
  70. ${CMAKE_COMMAND} --install)
  71. run_cmake_command(install-bad-dir
  72. ${CMAKE_COMMAND} --install dir-does-not-exist)
  73. run_cmake_command(install-unknown-command-short
  74. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} -invalid-command)
  75. run_cmake_command(install-unknown-command-long
  76. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} --invalid-command)
  77. run_cmake_command(install-options-to-vars
  78. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars
  79. --strip --prefix /var/test --config sample --component pack)
  80. run_cmake_command(install-default-dir-permissions-all
  81. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  82. --default-directory-permissions u=rwx,g=rx,o=rx)
  83. run_cmake_command(install-default-dir-permissions-afew
  84. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  85. --default-directory-permissions u=rwx,g=rx)
  86. run_cmake_command(install-default-dir-permissions-none
  87. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars)
  88. run_cmake_command(install-default-dir-permissions-invalid-comma1
  89. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  90. --default-directory-permissions u=rwxg=,x)
  91. run_cmake_command(install-default-dir-permissions-invalid-comma2
  92. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  93. --default-directory-permissions u=rwxg,=x)
  94. run_cmake_command(install-default-dir-permissions-comma-at-the-end
  95. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  96. --default-directory-permissions u=rwx,)
  97. run_cmake_command(install-default-dir-permissions-invalid-assignment
  98. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  99. --default-directory-permissions u=rwx,=x)
  100. run_cmake_command(install-default-dir-permissions-assignment-at-the-end
  101. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  102. --default-directory-permissions u=rwx,g=)
  103. run_cmake_command(install-default-dir-permissions-assignment-at-the-beginning
  104. ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-permissions-install-options-to-vars
  105. --default-directory-permissions =u=rwx,g=rx)
  106. run_cmake_command(cache-bad-entry
  107. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/)
  108. run_cmake_command(cache-empty-entry
  109. ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/)
  110. function(run_ExplicitDirs)
  111. set(RunCMake_TEST_NO_CLEAN 1)
  112. set(RunCMake_TEST_NO_SOURCE_DIR 1)
  113. set(source_dir ${RunCMake_BINARY_DIR}/ExplicitDirsMissing)
  114. file(REMOVE_RECURSE "${source_dir}")
  115. file(MAKE_DIRECTORY "${source_dir}")
  116. file(WRITE ${source_dir}/CMakeLists.txt [=[
  117. cmake_minimum_required(VERSION 3.13)
  118. project(ExplicitDirsMissing LANGUAGES NONE)
  119. ]=])
  120. set(RunCMake_TEST_SOURCE_DIR "${source_dir}")
  121. set(RunCMake_TEST_BINARY_DIR "${source_dir}")
  122. run_cmake_with_options(ExplicitDirs-no-S-B -DFOO=BAR)
  123. file(WRITE ${source_dir}/CMakeLists.txt [=[
  124. cmake_minimum_required(VERSION 3.13)
  125. project(ExplicitDirsMissing LANGUAGES NONE)
  126. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
  127. message(FATAL_ERROR "CWD used as binary dir")
  128. endif()
  129. message(STATUS "CMAKE_SOURCE_DIR='${CMAKE_SOURCE_DIR}'")
  130. message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'")
  131. ]=])
  132. file(REMOVE_RECURSE "${source_dir}/build")
  133. # Test with a setup where binary_dir won't be created by `run_cmake_with_options`
  134. run_cmake_with_options(ExplicitDirs-S-arg-build-dir-not-created -S ${source_dir} build/)
  135. run_cmake_with_options(ExplicitDirs-S-arg-reverse-build-dir-not-created build/ -S${source_dir} )
  136. file(REMOVE_RECURSE "${source_dir}/build")
  137. file(MAKE_DIRECTORY "${source_dir}/build")
  138. run_cmake_with_options(ExplicitDirs-S-arg-build-dir-empty -S ${source_dir} build/)
  139. set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
  140. set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
  141. set(working_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-cwd)
  142. set(RunCMake_TEST_SOURCE_DIR "${source_dir}")
  143. set(RunCMake_TEST_BINARY_DIR "${binary_dir}")
  144. file(MAKE_DIRECTORY "${working_dir}")
  145. set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${working_dir}")
  146. file(REMOVE_RECURSE "${binary_dir}")
  147. run_cmake_with_options(ExplicitDirs-S-arg -S ${source_dir} ${binary_dir})
  148. run_cmake_with_options(ExplicitDirs-S-arg-reverse-order ${binary_dir} -S${source_dir} )
  149. run_cmake_with_options(ExplicitDirs-S-no-arg -S )
  150. run_cmake_with_options(ExplicitDirs-S-no-arg2 -S -T)
  151. run_cmake_with_raw_args(ExplicitDirs-S-no-arg3 [[-S ""]])
  152. run_cmake_with_options(ExplicitDirs-S-B -S ${source_dir} -B ${binary_dir})
  153. run_cmake_with_options(ExplicitDirs-S-B-extra-path -S ${source_dir} -B ${binary_dir} /extra/path/)
  154. run_cmake_with_raw_args(ExplicitDirs-S-B-non-path "-S \"${source_dir}\" -B \"${binary_dir}\" \"\"")
  155. run_cmake_with_raw_args(ExplicitDirs-S-B-non-path2 "-S \"${source_dir}\" \"\" -B \"${binary_dir}\"")
  156. file(REMOVE_RECURSE "${binary_dir}/other_dir")
  157. file(MAKE_DIRECTORY "${binary_dir}/other_dir")
  158. file(WRITE "${binary_dir}/other_dir/CMakeLists.txt" [=[ ]=])
  159. run_cmake_with_options(ExplicitDirs-S-S-same -S ${source_dir} -S ${source_dir} -B ${binary_dir})
  160. run_cmake_with_options(ExplicitDirs-S-S-differs -S ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
  161. run_cmake_with_options(ExplicitDirs-S-implicit-same -S ${source_dir} ${source_dir} -B ${binary_dir})
  162. run_cmake_with_options(ExplicitDirs-S-implicit-differs -S ${source_dir} ${binary_dir}/other_dir -B ${binary_dir})
  163. run_cmake_with_options(ExplicitDirs-S-implicit-differs2 ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir})
  164. run_cmake_with_options(ExplicitDirs-S-implicit-differs3 ${binary_dir}/other_dir ${source_dir} -B ${binary_dir})
  165. run_cmake_with_options(ExplicitDirs-S-S-Sdiffers -S ${binary_dir}/other_dir1 -S ${binary_dir}/other_dir2 -S ${source_dir} -B ${binary_dir})
  166. run_cmake_with_options(ExplicitDirs-S-S-Simplicit ${binary_dir}/other_dir1 ${binary_dir}/other_dir2 ${source_dir} -B ${binary_dir})
  167. # make sure that -B can explicitly construct build directories
  168. file(REMOVE_RECURSE "${binary_dir}")
  169. run_cmake_with_options(ExplicitDirs-B-arg -B ${binary_dir} ${source_dir})
  170. file(REMOVE_RECURSE "${binary_dir}")
  171. run_cmake_with_options(ExplicitDirs-B-arg-reverse-order ${source_dir} -B${binary_dir})
  172. run_cmake_with_options(ExplicitDirs-B-no-arg -B )
  173. run_cmake_with_options(ExplicitDirs-B-no-arg2 -B -T)
  174. run_cmake_with_raw_args(ExplicitDirs-B-no-arg3 [[-B ""]])
  175. file(REMOVE_RECURSE "${binary_dir}")
  176. run_cmake_with_options(ExplicitDirs-B-S -B${binary_dir} -S${source_dir})
  177. run_cmake_with_options(ExplicitDirs-B-S-extra-path -B${binary_dir} -S${source_dir} /extra/path/)
  178. unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
  179. message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt")
  180. file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR})
  181. # CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified.
  182. # Path to initial-cache.txt is relative to the $PWD, which is normally set to ${RunCMake_TEST_BINARY_DIR}.
  183. run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt)
  184. # Test that full path works, too.
  185. run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
  186. run_cmake_with_options(ExplicitDirs-C_buildsrcdir -B DummyBuildDir ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
  187. endfunction()
  188. run_ExplicitDirs()
  189. function(run_Toolchain)
  190. set(RunCMake_TEST_NO_SOURCE_DIR 1)
  191. set(source_dir ${RunCMake_SOURCE_DIR}/Toolchain)
  192. run_cmake_with_options(toolchain-no-arg -S ${source_dir} --toolchain=)
  193. run_cmake_with_options(toolchain-valid-abs-path -S ${source_dir} --toolchain "${source_dir}/toolchain.cmake")
  194. run_cmake_with_options(toolchain-valid-rel-src-path -S ${source_dir} --toolchain=toolchain.cmake)
  195. set(RunCMake_TEST_NO_CLEAN 1)
  196. set(binary_dir ${RunCMake_BINARY_DIR}/Toolchain-build)
  197. set(RunCMake_TEST_BINARY_DIR "${binary_dir}")
  198. file(REMOVE_RECURSE "${binary_dir}")
  199. # Test that we both search the binary dir for toolchain files, and it takes
  200. # precedence over source dir
  201. file(WRITE ${binary_dir}/toolchain.cmake [=[
  202. set(CMAKE_SYSTEM_NAME Linux)
  203. set(toolchain_file binary_dir)
  204. ]=])
  205. run_cmake_with_options(toolchain-valid-rel-build-path -S ${source_dir} -B ${binary_dir} --toolchain toolchain.cmake)
  206. endfunction()
  207. run_Toolchain()
  208. function(run_BuildDir)
  209. # Use a single build tree for a few tests without cleaning.
  210. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
  211. set(RunCMake_TEST_NO_CLEAN 1)
  212. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  213. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  214. run_cmake(BuildDir)
  215. run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir ..
  216. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget)
  217. run_cmake_command(BuildDir--build-multiple-targets ${CMAKE_COMMAND} -E chdir ..
  218. ${CMAKE_COMMAND} --build BuildDir-build -t CustomTarget2 --target CustomTarget3)
  219. run_cmake_command(BuildDir--build-multiple-targets-fail ${CMAKE_COMMAND} -E chdir ..
  220. ${CMAKE_COMMAND} --build BuildDir-build -t CustomTargetFail --target CustomTarget3)
  221. run_cmake_command(BuildDir--build-multiple-targets-jobs ${CMAKE_COMMAND} -E chdir ..
  222. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget CustomTarget2 -j2 --target CustomTarget3)
  223. run_cmake_command(BuildDir--build-multiple-targets-with-clean-first ${CMAKE_COMMAND} -E chdir ..
  224. ${CMAKE_COMMAND} --build BuildDir-build --target clean CustomTarget)
  225. run_cmake_command(BuildDir--build-multiple-targets-with-clean-second ${CMAKE_COMMAND} -E chdir ..
  226. ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget clean)
  227. run_cmake_command(BuildDir--build-jobs-bad-number ${CMAKE_COMMAND} -E chdir ..
  228. ${CMAKE_COMMAND} --build BuildDir-build -j 12ab)
  229. run_cmake_command(BuildDir--build-jobs-good-number ${CMAKE_COMMAND} -E chdir ..
  230. ${CMAKE_COMMAND} --build BuildDir-build -j 2)
  231. run_cmake_command(BuildDir--build-jobs-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  232. ${CMAKE_COMMAND} --build BuildDir-build -j 2 --target CustomTarget)
  233. run_cmake_command(BuildDir--build--parallel-bad-number ${CMAKE_COMMAND} -E chdir ..
  234. ${CMAKE_COMMAND} --build BuildDir-build --parallel 12ab)
  235. run_cmake_command(BuildDir--build--parallel-good-number ${CMAKE_COMMAND} -E chdir ..
  236. ${CMAKE_COMMAND} --build BuildDir-build --parallel 2)
  237. run_cmake_command(BuildDir--build--parallel-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  238. ${CMAKE_COMMAND} --build BuildDir-build --parallel 2 --target CustomTarget)
  239. run_cmake_command(BuildDir--build-jobs-no-space-bad-number ${CMAKE_COMMAND} -E chdir ..
  240. ${CMAKE_COMMAND} --build BuildDir-build -j12ab)
  241. run_cmake_command(BuildDir--build-jobs-no-space-good-number ${CMAKE_COMMAND} -E chdir ..
  242. ${CMAKE_COMMAND} --build BuildDir-build -j2)
  243. run_cmake_command(BuildDir--build-jobs-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  244. ${CMAKE_COMMAND} --build BuildDir-build -j2 --target CustomTarget)
  245. run_cmake_command(BuildDir--build--parallel-no-space-bad-number ${CMAKE_COMMAND} -E chdir ..
  246. ${CMAKE_COMMAND} --build BuildDir-build --parallel12ab)
  247. run_cmake_command(BuildDir--build--parallel-no-space-good-number ${CMAKE_COMMAND} -E chdir ..
  248. ${CMAKE_COMMAND} --build BuildDir-build --parallel2)
  249. run_cmake_command(BuildDir--build--parallel-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  250. ${CMAKE_COMMAND} --build BuildDir-build --parallel2 --target CustomTarget)
  251. run_cmake_command(BuildDir--build-jobs-zero ${CMAKE_COMMAND} -E chdir ..
  252. ${CMAKE_COMMAND} --build BuildDir-build -j 0)
  253. run_cmake_command(BuildDir--build--parallel-zero ${CMAKE_COMMAND} -E chdir ..
  254. ${CMAKE_COMMAND} --build BuildDir-build --parallel 0)
  255. run_cmake_command(BuildDir--build-jobs-large ${CMAKE_COMMAND} -E chdir ..
  256. ${CMAKE_COMMAND} --build BuildDir-build -j 4294967293)
  257. run_cmake_command(BuildDir--build--parallel-large ${CMAKE_COMMAND} -E chdir ..
  258. ${CMAKE_COMMAND} --build BuildDir-build --parallel 4294967293)
  259. # No default jobs for FreeBSD build command
  260. if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
  261. run_cmake_command(BuildDir--build-jobs-no-number ${CMAKE_COMMAND} -E chdir ..
  262. ${CMAKE_COMMAND} --build BuildDir-build -j)
  263. run_cmake_command(BuildDir--build-jobs-no-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  264. ${CMAKE_COMMAND} --build BuildDir-build -j --target CustomTarget)
  265. if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja")
  266. set(_backup_lang "$ENV{LANG}")
  267. set(_backup_lc_messages "$ENV{LC_MESSAGES}")
  268. set(ENV{LANG} "C")
  269. set(ENV{LC_MESSAGES} "C")
  270. run_cmake_command(BuildDir--build-jobs-no-number-trailing--invalid-target ${CMAKE_COMMAND} -E chdir ..
  271. ${CMAKE_COMMAND} --build BuildDir-build -j --target invalid-target)
  272. set(ENV{LANG} "${_backup_lang}")
  273. set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
  274. endif()
  275. run_cmake_command(BuildDir--build--parallel-no-number ${CMAKE_COMMAND} -E chdir ..
  276. ${CMAKE_COMMAND} --build BuildDir-build --parallel)
  277. run_cmake_command(BuildDir--build--parallel-no-number-trailing--target ${CMAKE_COMMAND} -E chdir ..
  278. ${CMAKE_COMMAND} --build BuildDir-build --parallel --target CustomTarget)
  279. endif()
  280. endfunction()
  281. run_BuildDir()
  282. function(run_EnvironmentGenerator)
  283. set(source_dir ${RunCMake_SOURCE_DIR}/EnvGenerator)
  284. set(ENV{CMAKE_GENERATOR_INSTANCE} "instance")
  285. set(ENV{CMAKE_GENERATOR_PLATFORM} "platform")
  286. set(ENV{CMAKE_GENERATOR_TOOLSET} "toolset")
  287. run_cmake_command(Envgen-warnings ${CMAKE_COMMAND} -G)
  288. unset(ENV{CMAKE_GENERATOR_INSTANCE})
  289. unset(ENV{CMAKE_GENERATOR_PLATFORM})
  290. unset(ENV{CMAKE_GENERATOR_TOOLSET})
  291. # Test CMAKE_GENERATOR without actual configuring
  292. run_cmake_command(Envgen-unset ${CMAKE_COMMAND} -G)
  293. set(ENV{CMAKE_GENERATOR} "Ninja")
  294. run_cmake_command(Envgen-ninja ${CMAKE_COMMAND} -G)
  295. set(ENV{CMAKE_GENERATOR} "NoSuchGenerator")
  296. run_cmake_command(Envgen-bad ${CMAKE_COMMAND} -G)
  297. unset(ENV{CMAKE_GENERATOR})
  298. if(RunCMake_GENERATOR MATCHES "Visual Studio.*")
  299. set(ENV{CMAKE_GENERATOR} "${RunCMake_GENERATOR}")
  300. run_cmake_command(Envgen ${CMAKE_COMMAND} ${source_dir})
  301. # Toolset is available since VS 2010.
  302. if(RunCMake_GENERATOR MATCHES "Visual Studio [1-9][0-9]")
  303. set(ENV{CMAKE_GENERATOR_TOOLSET} "invalid")
  304. # Envvar shouldn't affect existing build tree
  305. run_cmake_command(Envgen-toolset-existing ${CMAKE_COMMAND} -E chdir ..
  306. ${CMAKE_COMMAND} --build Envgen-build)
  307. run_cmake_command(Envgen-toolset-invalid ${CMAKE_COMMAND} ${source_dir})
  308. # Command line -G implies -T""
  309. run_cmake_command(Envgen-G-implicit-toolset ${CMAKE_COMMAND} -G "${RunCMake_GENERATOR}" ${source_dir})
  310. run_cmake_command(Envgen-T-toolset ${CMAKE_COMMAND} -T "fromcli" ${source_dir})
  311. unset(ENV{CMAKE_GENERATOR_TOOLSET})
  312. endif()
  313. # Platform can be set only if not in generator name.
  314. if(RunCMake_GENERATOR MATCHES "^Visual Studio [0-9]+ [0-9]+$")
  315. set(ENV{CMAKE_GENERATOR_PLATFORM} "invalid")
  316. # Envvar shouldn't affect existing build tree
  317. run_cmake_command(Envgen-platform-existing ${CMAKE_COMMAND} -E chdir ..
  318. ${CMAKE_COMMAND} --build Envgen-build)
  319. if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
  320. set(RunCMake-stderr-file "Envgen-platform-invalid-stderr-vs9.txt")
  321. endif()
  322. run_cmake_command(Envgen-platform-invalid ${CMAKE_COMMAND} ${source_dir})
  323. unset(RunCMake-stderr-file)
  324. # Command line -G implies -A""
  325. run_cmake_command(Envgen-G-implicit-platform ${CMAKE_COMMAND} -G "${RunCMake_GENERATOR}" ${source_dir})
  326. if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
  327. set(RunCMake-stderr-file "Envgen-A-platform-stderr-vs9.txt")
  328. endif()
  329. run_cmake_command(Envgen-A-platform ${CMAKE_COMMAND} -A "fromcli" ${source_dir})
  330. unset(RunCMake-stderr-file)
  331. unset(ENV{CMAKE_GENERATOR_PLATFORM})
  332. endif()
  333. # Instance is available since VS 2017.
  334. if(RunCMake_GENERATOR MATCHES "Visual Studio 1[567].*")
  335. set(ENV{CMAKE_GENERATOR_INSTANCE} "invalid")
  336. # Envvar shouldn't affect existing build tree
  337. run_cmake_command(Envgen-instance-existing ${CMAKE_COMMAND} -E chdir ..
  338. ${CMAKE_COMMAND} --build Envgen-build)
  339. run_cmake_command(Envgen-instance-invalid ${CMAKE_COMMAND} ${source_dir})
  340. unset(ENV{CMAKE_GENERATOR_INSTANCE})
  341. endif()
  342. unset(ENV{CMAKE_GENERATOR})
  343. endif()
  344. endfunction()
  345. run_EnvironmentGenerator()
  346. function(run_EnvironmentExportCompileCommands)
  347. set(RunCMake_TEST_SOURCE_DIR ${RunCMake_SOURCE_DIR}/env-export-compile-commands)
  348. run_cmake(env-export-compile-commands-unset)
  349. set(ENV{CMAKE_EXPORT_COMPILE_COMMANDS} ON)
  350. run_cmake(env-export-compile-commands-set)
  351. set(RunCMake_TEST_OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF)
  352. run_cmake(env-export-compile-commands-override)
  353. unset(ENV{CMAKE_EXPORT_COMPILE_COMMANDS})
  354. endfunction(run_EnvironmentExportCompileCommands)
  355. if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ninja")
  356. run_EnvironmentExportCompileCommands()
  357. endif()
  358. function(run_EnvironmentBuildType)
  359. set(ENV{CMAKE_BUILD_TYPE} "BuildTypeEnv")
  360. run_cmake(EnvBuildType)
  361. run_cmake_with_options(EnvBuildTypeIgnore -DCMAKE_BUILD_TYPE=BuildTypeOpt)
  362. unset(ENV{CMAKE_BUILD_TYPE})
  363. endfunction()
  364. function(run_EnvironmentConfigTypes)
  365. set(ENV{CMAKE_CONFIGURATION_TYPES} "ConfigTypesEnv")
  366. run_cmake(EnvConfigTypes)
  367. run_cmake_with_options(EnvConfigTypesIgnore -DCMAKE_CONFIGURATION_TYPES=ConfigTypesOpt)
  368. unset(ENV{CMAKE_CONFIGURATION_TYPES})
  369. endfunction()
  370. if(RunCMake_GENERATOR MATCHES "Make|^Ninja$")
  371. run_EnvironmentBuildType()
  372. elseif(RunCMake_GENERATOR MATCHES "Ninja Multi-Config|Visual Studio|Xcode")
  373. run_EnvironmentConfigTypes()
  374. endif()
  375. function(run_EnvironmentToolchain)
  376. set(ENV{CMAKE_TOOLCHAIN_FILE} "${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake")
  377. run_cmake(EnvToolchainAbsolute)
  378. run_cmake_with_options(EnvToolchainIgnore -DCMAKE_TOOLCHAIN_FILE=)
  379. unset(ENV{CMAKE_TOOLCHAIN_FILE})
  380. set(ENV{CMAKE_TOOLCHAIN_FILE} "EnvToolchain-toolchain.cmake")
  381. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EnvToolchainRelative-build)
  382. set(RunCMake_TEST_NO_CLEAN 1)
  383. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  384. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  385. configure_file("${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake" "${RunCMake_TEST_BINARY_DIR}/EnvToolchain-toolchain.cmake" COPYONLY)
  386. run_cmake(EnvToolchainRelative)
  387. unset(ENV{CMAKE_TOOLCHAIN_FILE})
  388. unset(RunCMake_TEST_NO_CLEAN)
  389. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EnvToolchainNone-build)
  390. run_cmake(EnvToolchainNone)
  391. set(RunCMake_TEST_NO_CLEAN 1)
  392. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles")
  393. set(ENV{CMAKE_TOOLCHAIN_FILE} "${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake")
  394. run_cmake_command(EnvToolchainNoneExisting ${CMAKE_COMMAND} .)
  395. unset(ENV{CMAKE_TOOLCHAIN_FILE})
  396. unset(RunCMake_TEST_NO_CLEAN)
  397. endfunction()
  398. run_EnvironmentToolchain()
  399. function(run_EnvironmentColor)
  400. set(ENV{CMAKE_COLOR_DIAGNOSTICS} "ON")
  401. run_cmake(EnvColorOn)
  402. unset(ENV{CMAKE_COLOR_DIAGNOSTICS})
  403. run_cmake(EnvColorDefault)
  404. endfunction()
  405. run_EnvironmentColor()
  406. if(RunCMake_GENERATOR STREQUAL "Ninja")
  407. # Use a single build tree for a few tests without cleaning.
  408. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)
  409. set(RunCMake_TEST_NO_CLEAN 1)
  410. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  411. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  412. set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1)
  413. run_cmake(Build)
  414. unset(RunCMake_TEST_OPTIONS)
  415. run_cmake_command(Build-ninja-v ${CMAKE_COMMAND} --build .)
  416. unset(RunCMake_TEST_BINARY_DIR)
  417. unset(RunCMake_TEST_NO_CLEAN)
  418. endif()
  419. run_cmake_command(E_create_symlink-no-arg
  420. ${CMAKE_COMMAND} -E create_symlink
  421. )
  422. run_cmake_command(E_create_symlink-missing-dir
  423. ${CMAKE_COMMAND} -E create_symlink T missing-dir/L
  424. )
  425. # Use a single build tree for a few tests without cleaning.
  426. # These tests are special on Windows since it will only fail if the user
  427. # running the test does not have the priveldge to create symlinks. If this
  428. # happens we clear the msg in the -check.cmake and say that the test passes
  429. set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?")
  430. set(RunCMake_TEST_BINARY_DIR
  431. ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build)
  432. set(RunCMake_TEST_NO_CLEAN 1)
  433. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  434. run_cmake_command(E_create_symlink-broken-create
  435. ${CMAKE_COMMAND} -E create_symlink T L
  436. )
  437. run_cmake_command(E_create_symlink-broken-replace
  438. ${CMAKE_COMMAND} -E create_symlink . L
  439. )
  440. unset(RunCMake_TEST_BINARY_DIR)
  441. unset(RunCMake_TEST_NO_CLEAN)
  442. unset(RunCMake_DEFAULT_stderr)
  443. run_cmake_command(E_create_symlink-no-replace-dir
  444. ${CMAKE_COMMAND} -E create_symlink T .
  445. )
  446. #create hard link tests
  447. run_cmake_command(E_create_hardlink-no-arg
  448. ${CMAKE_COMMAND} -E create_hardlink
  449. )
  450. set(dir ${RunCMake_BINARY_DIR}/hardlink_tests)
  451. file(REMOVE_RECURSE "${dir}")
  452. file(MAKE_DIRECTORY ${dir})
  453. run_cmake_command(E_create_hardlink-non-existent-source
  454. ${CMAKE_COMMAND} -E create_hardlink ${dir}/I_dont_exist ${dir}/link
  455. )
  456. file(TOUCH ${dir}/1)
  457. run_cmake_command(E_create_hardlink-ok
  458. ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/1-link
  459. )
  460. run_cmake_command(E_create_hardlink-no-directory
  461. ${CMAKE_COMMAND} -E create_hardlink ${dir}/1 ${dir}/a/1-link
  462. )
  463. #On Windows, if the user does not have sufficient privileges
  464. #don't fail this test
  465. set(RunCMake_DEFAULT_stderr "(A required privilege is not held by the client)?")
  466. run_cmake_command(E_create_hardlink-unresolved-symlink-prereq
  467. ${CMAKE_COMMAND} -E create_symlink ${dir}/1 ${dir}/1-symlink
  468. )
  469. file(REMOVE ${dir}/1)
  470. run_cmake_command(E_create_hardlink-unresolved-symlink
  471. ${CMAKE_COMMAND} -E create_hardlink ${dir}/1-symlink ${dir}/1s-link
  472. )
  473. unset(RunCMake_DEFAULT_stderr)
  474. set(in ${RunCMake_SOURCE_DIR}/copy_input)
  475. set(out ${RunCMake_BINARY_DIR}/copy_output)
  476. file(REMOVE_RECURSE "${out}")
  477. file(MAKE_DIRECTORY ${out})
  478. run_cmake_command(E_copy-one-source-file
  479. ${CMAKE_COMMAND} -E copy ${out}/f1.txt)
  480. run_cmake_command(E_copy-one-source-directory-target-is-directory
  481. ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${out})
  482. run_cmake_command(E_copy-three-source-files-target-is-directory
  483. ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out})
  484. run_cmake_command(E_copy-three-source-files-target-is-file
  485. ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt)
  486. run_cmake_command(E_copy-two-good-and-one-bad-source-files-target-is-directory
  487. ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/not_existing_file.bad ${in}/f3.txt ${out})
  488. run_cmake_command(E_copy_if_different-one-source-directory-target-is-directory
  489. ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${out})
  490. run_cmake_command(E_copy_if_different-three-source-files-target-is-directory
  491. ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out})
  492. run_cmake_command(E_copy_if_different-three-source-files-target-is-file
  493. ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt)
  494. unset(in)
  495. unset(out)
  496. set(in ${RunCMake_SOURCE_DIR}/copy_input)
  497. set(out ${RunCMake_BINARY_DIR}/copy_directory_output)
  498. set(outfile ${out}/file_for_test.txt)
  499. file(REMOVE_RECURSE "${out}")
  500. file(MAKE_DIRECTORY ${out})
  501. file(WRITE ${outfile} "")
  502. run_cmake_command(E_copy_directory-three-source-files-target-is-directory
  503. ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out})
  504. run_cmake_command(E_copy_directory-three-source-files-target-is-file
  505. ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${outfile})
  506. run_cmake_command(E_copy_directory-three-source-files-target-is-not-exist
  507. ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out}/not_existing_directory)
  508. unset(in)
  509. unset(out)
  510. unset(outfile)
  511. set(out ${RunCMake_BINARY_DIR}/make_directory_output)
  512. set(outfile ${out}/file_for_test.txt)
  513. file(REMOVE_RECURSE "${out}")
  514. file(MAKE_DIRECTORY ${out})
  515. file(WRITE ${outfile} "")
  516. run_cmake_command(E_make_directory-three-directories
  517. ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2)
  518. run_cmake_command(E_remove_directory-three-directories
  519. ${CMAKE_COMMAND} -E remove_directory ${out}/d1 ${out}/d2 ${out}/d2)
  520. run_cmake_command(E_make_directory-directory-with-parent
  521. ${CMAKE_COMMAND} -E make_directory ${out}/parent/child)
  522. run_cmake_command(E_remove_directory-directory-with-parent
  523. ${CMAKE_COMMAND} -E remove_directory ${out}/parent)
  524. run_cmake_command(E_make_directory-two-directories-and-file
  525. ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile})
  526. run_cmake_command(E_remove_directory-two-directories-and-file
  527. ${CMAKE_COMMAND} -E remove_directory ${out}/d1 ${out}/d2 ${outfile})
  528. if(UNIX)
  529. file(MAKE_DIRECTORY ${out}/dir)
  530. file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC)
  531. file(CREATE_LINK ${outfile} ${out}/link_file_for_test.txt SYMBOLIC)
  532. run_cmake_command(E_remove_directory-symlink-dir
  533. ${CMAKE_COMMAND} -E remove_directory ${out}/link_dir)
  534. run_cmake_command(E_remove_directory-symlink-file
  535. ${CMAKE_COMMAND} -E remove_directory ${out}/link_file_for_test.txt)
  536. endif()
  537. unset(out)
  538. unset(outfile)
  539. set(out ${RunCMake_BINARY_DIR}/rm_tests)
  540. file(REMOVE_RECURSE "${out}")
  541. file(MAKE_DIRECTORY ${out})
  542. file(TOUCH ${out}/existing.txt)
  543. run_cmake_command(E_rm_file_force_existing
  544. ${CMAKE_COMMAND} -E rm -f ${out}/existing.txt)
  545. file(TOUCH ${out}/existing.txt)
  546. run_cmake_command(E_rm_file_non_force_existing
  547. ${CMAKE_COMMAND} -E rm ${out}/existing.txt)
  548. run_cmake_command(E_rm_file_force_non_existing
  549. ${CMAKE_COMMAND} -E rm -f ${out}/not_existing.txt)
  550. run_cmake_command(E_rm_file_non_force_non_existing
  551. ${CMAKE_COMMAND} -E rm ${out}/not_existing.txt)
  552. file(TOUCH ${out}/existing.txt)
  553. run_cmake_command(E_rm_file_recursive_existing
  554. ${CMAKE_COMMAND} -E rm -r ${out}/existing.txt)
  555. run_cmake_command(E_rm_file_recursive_non_existing
  556. ${CMAKE_COMMAND} -E rm -r ${out}/not_existing.txt)
  557. file(MAKE_DIRECTORY ${out}/d1 ${out}/d2)
  558. run_cmake_command(E_rm_non_recursive_directory-two-directories
  559. ${CMAKE_COMMAND} -E rm ${out}/d1 ${out}/d2)
  560. run_cmake_command(E_rm_recursive_directory-two-directories
  561. ${CMAKE_COMMAND} -E rm -R ${out}/d1 ${out}/d2)
  562. run_cmake_command(E_rm_no_file_specified
  563. ${CMAKE_COMMAND} -E rm -rf)
  564. run_cmake_command(E_rm_empty_file_specified
  565. ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_rm_empty_file_specified.cmake)
  566. run_cmake_command(E_rm_bad_argument
  567. ${CMAKE_COMMAND} -E rm -rd ${out}/d1 ${out}/d2)
  568. file(MAKE_DIRECTORY ${out}/d1 ${out}/d2)
  569. file(WRITE ${out}/test.txt "")
  570. run_cmake_command(E_rm_force_recursive_directory_with_files
  571. ${CMAKE_COMMAND} -E rm -rf ${out}/)
  572. run_cmake_command(E_rm_force_recursive_non_existing_file
  573. ${CMAKE_COMMAND} -E rm -Rf ${out}/test.txt)
  574. if(NOT WIN32 AND NOT CYGWIN)
  575. file(MAKE_DIRECTORY ${out})
  576. file(TOUCH ${out}/existing.txt)
  577. file(MAKE_DIRECTORY ${out}/dir)
  578. file(TOUCH ${out}/dir/existing.txt) # add a file in the folder
  579. file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC)
  580. file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC)
  581. file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC)
  582. run_cmake_command(E_rm_file_link_existing
  583. ${CMAKE_COMMAND} -E rm ${out}/existing_file_link.txt)
  584. run_cmake_command(E_rm_directory_link_existing
  585. ${CMAKE_COMMAND} -E rm ${out}/link_dir)
  586. run_cmake_command(E_rm_file_link_non_existing
  587. ${CMAKE_COMMAND} -E rm ${out}/non_existing_file_link.txt)
  588. file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC)
  589. file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC)
  590. file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC)
  591. run_cmake_command(E_rm_recursive_file_link_existing
  592. ${CMAKE_COMMAND} -E rm -R ${out}/existing_file_link.txt)
  593. run_cmake_command(E_rm_recursive_directory_link_existing
  594. ${CMAKE_COMMAND} -E rm -r ${out}/link_dir)
  595. run_cmake_command(E_rm_recursive_file_link_non_existing
  596. ${CMAKE_COMMAND} -E rm -r ${out}/non_existing_file_link.txt)
  597. endif()
  598. unset(out)
  599. # cat tests
  600. set(out ${RunCMake_BINARY_DIR}/cat_tests)
  601. file(REMOVE_RECURSE "${out}")
  602. file(MAKE_DIRECTORY ${out})
  603. run_cmake_command(E_cat_non_existing_file
  604. ${CMAKE_COMMAND} -E cat ${out}/non-existing-file.txt)
  605. if(UNIX AND NOT MSYS)
  606. # test non readable file only if not root
  607. execute_process(
  608. COMMAND id -u $ENV{USER}
  609. OUTPUT_VARIABLE uid
  610. OUTPUT_STRIP_TRAILING_WHITESPACE)
  611. if(NOT "${uid}" STREQUAL "0")
  612. # Create non readable file
  613. set(inside_folder "${out}/in")
  614. file(MAKE_DIRECTORY ${inside_folder})
  615. file(WRITE "${inside_folder}/non_readable_file.txt" "first file to append\n")
  616. file(COPY "${inside_folder}/non_readable_file.txt" DESTINATION "${out}" FILE_PERMISSIONS OWNER_WRITE)
  617. run_cmake_command(E_cat_non_readable_file
  618. ${CMAKE_COMMAND} -E cat "${out}/non_readable_file.txt")
  619. endif()
  620. endif()
  621. run_cmake_command(E_cat_option_not_handled
  622. ${CMAKE_COMMAND} -E cat -f)
  623. run_cmake_command(E_cat_directory
  624. ${CMAKE_COMMAND} -E cat ${out})
  625. file(WRITE "${out}/first_file.txt" "first file to append\n")
  626. file(WRITE "${out}/second_file.txt" "second file to append\n")
  627. file(WRITE "${out}/empty_file.txt" "")
  628. file(WRITE "${out}/unicode_file.txt" "àéùç - 한국어") # Korean in Korean
  629. run_cmake_command(E_cat_good_cat
  630. ${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/empty_file.txt" "${out}/unicode_file.txt")
  631. run_cmake_command(E_cat_good_binary_cat
  632. ${CMAKE_COMMAND} -E cat "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj" "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj")
  633. # To test whether the double dash (--) works, we need to control the working directory
  634. # in order to be able to pass a relative path that starts with a dash.
  635. file(WRITE "${out}/-file-starting-with-dash.txt" "file starting with dash, not an option\n")
  636. set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${out}")
  637. run_cmake_command(E_cat-with-double-dash ${CMAKE_COMMAND} -E cat -- "-file-starting-with-dash.txt")
  638. run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-starting-with-dash.txt")
  639. unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
  640. unset(out)
  641. run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
  642. run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)
  643. run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1)
  644. run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake)
  645. run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake)
  646. # To test whether the double dash (--) works for the env command, we need a command that e.g. contains an equals sign (=)
  647. # and would normally be interpreted as an NAME=VALUE environment variable.
  648. # Ensuring such a command is done by simply copying the trivial exit_code executable with a different name.
  649. cmake_path(GET EXIT_CODE_EXE FILENAME exit_code)
  650. file(COPY_FILE "${EXIT_CODE_EXE}" "${RunCMake_BINARY_DIR}/env=${exit_code}")
  651. run_cmake_command(E_env-with-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 -- "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
  652. run_cmake_command(E_env-without-double-dash ${CMAKE_COMMAND} -E env TEST_ENV=1 "${RunCMake_BINARY_DIR}/env=${exit_code}" zero_exit)
  653. run_cmake_command(E_md5sum-dir ${CMAKE_COMMAND} -E md5sum .)
  654. run_cmake_command(E_sha1sum-dir ${CMAKE_COMMAND} -E sha1sum .)
  655. run_cmake_command(E_sha224sum-dir ${CMAKE_COMMAND} -E sha224sum .)
  656. run_cmake_command(E_sha256sum-dir ${CMAKE_COMMAND} -E sha256sum .)
  657. run_cmake_command(E_sha384sum-dir ${CMAKE_COMMAND} -E sha384sum .)
  658. run_cmake_command(E_sha512sum-dir ${CMAKE_COMMAND} -E sha512sum .)
  659. run_cmake_command(E_md5sum-no-file ${CMAKE_COMMAND} -E md5sum nonexisting)
  660. run_cmake_command(E_sha1sum-no-file ${CMAKE_COMMAND} -E sha1sum nonexisting)
  661. run_cmake_command(E_sha224sum-no-file ${CMAKE_COMMAND} -E sha224sum nonexisting)
  662. run_cmake_command(E_sha256sum-no-file ${CMAKE_COMMAND} -E sha256sum nonexisting)
  663. run_cmake_command(E_sha384sum-no-file ${CMAKE_COMMAND} -E sha384sum nonexisting)
  664. run_cmake_command(E_sha512sum-no-file ${CMAKE_COMMAND} -E sha512sum nonexisting)
  665. file(WRITE "${RunCMake_BINARY_DIR}/dummy" "dummy")
  666. run_cmake_command(E_md5sum ${CMAKE_COMMAND} -E md5sum ../dummy)
  667. run_cmake_command(E_md5sum-mixed ${CMAKE_COMMAND} -E md5sum . ../dummy nonexisting)
  668. run_cmake_command(E_sha1sum ${CMAKE_COMMAND} -E sha1sum ../dummy)
  669. run_cmake_command(E_sha224sum ${CMAKE_COMMAND} -E sha224sum ../dummy)
  670. run_cmake_command(E_sha256sum ${CMAKE_COMMAND} -E sha256sum ../dummy)
  671. run_cmake_command(E_sha384sum ${CMAKE_COMMAND} -E sha384sum ../dummy)
  672. run_cmake_command(E_sha512sum ${CMAKE_COMMAND} -E sha512sum ../dummy)
  673. file(REMOVE "${RunCMake_BINARY_DIR}/dummy")
  674. set(RunCMake_DEFAULT_stderr ".")
  675. run_cmake_command(E_sleep-no-args ${CMAKE_COMMAND} -E sleep)
  676. unset(RunCMake_DEFAULT_stderr)
  677. run_cmake_command(E_sleep-bad-arg1 ${CMAKE_COMMAND} -E sleep x)
  678. run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1)
  679. run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1)
  680. run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR})
  681. run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake)
  682. # Documented to return the same result as above even if -S and -B are set to something else.
  683. # Tests the values of CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR.
  684. run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake -S something_else -B something_else_1)
  685. # Place an initial cache where C_basic will find it when passed the relative path "..".
  686. file(COPY ${RunCMake_SOURCE_DIR}/C_basic_initial-cache.txt DESTINATION ${RunCMake_BINARY_DIR})
  687. run_cmake_with_options(C_basic -C ../C_basic_initial-cache.txt)
  688. run_cmake_with_options(C_basic_fullpath -C ${RunCMake_BINARY_DIR}/C_basic_initial-cache.txt)
  689. set(RunCMake_TEST_OPTIONS
  690. "-DFOO=-DBAR:BOOL=BAZ")
  691. run_cmake(D_nested_cache)
  692. set(RunCMake_TEST_OPTIONS
  693. "-DFOO:STRING=-DBAR:BOOL=BAZ")
  694. run_cmake(D_typed_nested_cache)
  695. set(RunCMake_TEST_OPTIONS -Wno-dev)
  696. run_cmake(Wno-dev)
  697. unset(RunCMake_TEST_OPTIONS)
  698. set(RunCMake_TEST_OPTIONS -Wdev)
  699. run_cmake(Wdev)
  700. unset(RunCMake_TEST_OPTIONS)
  701. set(RunCMake_TEST_OPTIONS -Werror=dev)
  702. run_cmake(Werror_dev)
  703. unset(RunCMake_TEST_OPTIONS)
  704. set(RunCMake_TEST_OPTIONS -Wno-error=dev)
  705. run_cmake(Wno-error_deprecated)
  706. unset(RunCMake_TEST_OPTIONS)
  707. # -Wdev should not override deprecated options if specified
  708. set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated)
  709. run_cmake(Wno-deprecated)
  710. unset(RunCMake_TEST_OPTIONS)
  711. set(RunCMake_TEST_OPTIONS -Wno-deprecated -Wdev)
  712. run_cmake(Wno-deprecated)
  713. unset(RunCMake_TEST_OPTIONS)
  714. # -Wdev should enable deprecated warnings as well
  715. set(RunCMake_TEST_OPTIONS -Wdev)
  716. run_cmake(Wdeprecated)
  717. unset(RunCMake_TEST_OPTIONS)
  718. # -Werror=dev should enable deprecated errors as well
  719. set(RunCMake_TEST_OPTIONS -Werror=dev)
  720. run_cmake(Werror_deprecated)
  721. unset(RunCMake_TEST_OPTIONS)
  722. set(RunCMake_TEST_OPTIONS -Wdeprecated)
  723. run_cmake(Wdeprecated)
  724. unset(RunCMake_TEST_OPTIONS)
  725. set(RunCMake_TEST_OPTIONS -Wno-deprecated)
  726. run_cmake(Wno-deprecated)
  727. unset(RunCMake_TEST_OPTIONS)
  728. set(RunCMake_TEST_OPTIONS -Werror=deprecated)
  729. run_cmake(Werror_deprecated)
  730. unset(RunCMake_TEST_OPTIONS)
  731. set(RunCMake_TEST_OPTIONS -Wno-error=deprecated)
  732. run_cmake(Wno-error_deprecated)
  733. unset(RunCMake_TEST_OPTIONS)
  734. set(RunCMake_TEST_OPTIONS -Werror=deprecated -Wno-error=deprecated)
  735. run_cmake(Wno-error_deprecated)
  736. unset(RunCMake_TEST_OPTIONS)
  737. # Dev warnings should be on by default
  738. run_cmake(Wdev)
  739. # Deprecated warnings should be on by default
  740. run_cmake(Wdeprecated)
  741. # Conflicting -W options should honor the last value
  742. set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
  743. run_cmake(Wdev)
  744. unset(RunCMake_TEST_OPTIONS)
  745. set(RunCMake_TEST_OPTIONS -Wdev -Wno-dev)
  746. run_cmake(Wno-dev)
  747. unset(RunCMake_TEST_OPTIONS)
  748. run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -B DummyBuildDir -W)
  749. run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -B DummyBuildDir -Wno-)
  750. run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -B DummyBuildDir -Werror=)
  751. set(RunCMake_TEST_OPTIONS --debug-output)
  752. run_cmake(debug-output)
  753. unset(RunCMake_TEST_OPTIONS)
  754. set(RunCMake_TEST_OPTIONS --trace)
  755. run_cmake(trace)
  756. unset(RunCMake_TEST_OPTIONS)
  757. set(RunCMake_TEST_OPTIONS --trace-expand)
  758. run_cmake(trace-expand)
  759. unset(RunCMake_TEST_OPTIONS)
  760. set(RunCMake_TEST_OPTIONS --trace-expand --warn-uninitialized)
  761. run_cmake(trace-expand-warn-uninitialized)
  762. unset(RunCMake_TEST_OPTIONS)
  763. set(RunCMake_TEST_OPTIONS --trace-redirect=${RunCMake_BINARY_DIR}/redirected.trace)
  764. run_cmake(trace-redirect)
  765. unset(RunCMake_TEST_OPTIONS)
  766. set(RunCMake_TEST_OPTIONS --trace-redirect=/no/such/file.txt)
  767. run_cmake(trace-redirect-nofile)
  768. unset(RunCMake_TEST_OPTIONS)
  769. set(RunCMake_TEST_OPTIONS --trace --trace-format=json-v1 --trace-redirect=${RunCMake_BINARY_DIR}/json-v1.trace)
  770. run_cmake(trace-json-v1)
  771. unset(RunCMake_TEST_OPTIONS)
  772. set(RunCMake_TEST_OPTIONS --trace-expand --trace-format=json-v1 --trace-redirect=${RunCMake_BINARY_DIR}/json-v1-expand.trace)
  773. run_cmake(trace-json-v1-expand)
  774. unset(RunCMake_TEST_OPTIONS)
  775. set(RunCMake_TEST_OPTIONS -Wno-deprecated --warn-uninitialized)
  776. run_cmake(warn-uninitialized)
  777. unset(RunCMake_TEST_OPTIONS)
  778. set(RunCMake_TEST_OPTIONS --trace-source=trace-only-this-file.cmake)
  779. run_cmake(trace-source)
  780. unset(RunCMake_TEST_OPTIONS)
  781. set(RunCMake_TEST_OPTIONS --debug-trycompile)
  782. run_cmake(debug-trycompile)
  783. unset(RunCMake_TEST_OPTIONS)
  784. function(run_cmake_depends)
  785. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends")
  786. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build")
  787. set(RunCMake_TEST_NO_CLEAN 1)
  788. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  789. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  790. file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake" "
  791. set(CMAKE_DEPENDS_LANGUAGES \"C\")
  792. set(CMAKE_DEPENDS_CHECK_C
  793. \"${RunCMake_TEST_SOURCE_DIR}/test.c\"
  794. \"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/test.c.o\"
  795. )
  796. ")
  797. file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeDirectoryInformation.cmake" "
  798. set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\")
  799. set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\")
  800. ")
  801. run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends
  802. "Unix Makefiles"
  803. ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR}
  804. ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR}
  805. ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake
  806. )
  807. endfunction()
  808. run_cmake_depends()
  809. function(reject_fifo)
  810. find_program(BASH_EXECUTABLE bash)
  811. if(BASH_EXECUTABLE)
  812. set(BASH_COMMAND_ARGUMENT "'${CMAKE_COMMAND}' -P <(echo 'return()')")
  813. run_cmake_command(reject_fifo ${BASH_EXECUTABLE} -c ${BASH_COMMAND_ARGUMENT})
  814. endif()
  815. endfunction()
  816. if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN" AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS")
  817. reject_fifo()
  818. run_cmake_command(closed_stdin sh -c "\"${CMAKE_COMMAND}\" --version <&-")
  819. run_cmake_command(closed_stdout sh -c "\"${CMAKE_COMMAND}\" --version >&-")
  820. run_cmake_command(closed_stderr sh -c "\"${CMAKE_COMMAND}\" --version 2>&-")
  821. run_cmake_command(closed_stdall sh -c "\"${CMAKE_COMMAND}\" --version <&- >&- 2>&-")
  822. endif()
  823. function(run_llvm_rc)
  824. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/llvm_rc-build")
  825. set(RunCMake_TEST_NO_CLEAN 1)
  826. file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
  827. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
  828. run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc)
  829. run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test")
  830. run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ++ ${CMAKE_COMMAND} -E echo "This is a test")
  831. run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake ++ ${CMAKE_COMMAND} -E echo "This is a test")
  832. run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -P FailedProgram.cmake )
  833. if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp)
  834. message(SEND_ERROR "${test} - FAILED:\n"
  835. "test.tmp was not deleted")
  836. endif()
  837. file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir")
  838. run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${LLVM_RC} -bad /FO SOURCE_DIR/llvmrc.result test.tmp )
  839. if(EXISTS ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/test.tmp)
  840. message(SEND_ERROR "${test} - FAILED:\n"
  841. "test.tmp was not deleted")
  842. endif()
  843. file(READ ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/llvmrc.result LLVMRC_RESULT)
  844. if(NOT "${LLVMRC_RESULT}" STREQUAL "This is a test\n")
  845. message(SEND_ERROR "${test} - FAILED:\n"
  846. "llvmrc.result was not created")
  847. endif()
  848. unset(LLVMRC_RESULT)
  849. endfunction()
  850. run_llvm_rc()
  851. set(RunCMake_TEST_OPTIONS --profiling-output=/no/such/file.txt --profiling-format=google-trace)
  852. run_cmake(profiling-all-params)
  853. unset(RunCMake_TEST_OPTIONS)
  854. set(RunCMake_TEST_OPTIONS --profiling-output=/no/such/file.txt --profiling-format=invalid-format)
  855. run_cmake(profiling-invalid-format)
  856. unset(RunCMake_TEST_OPTIONS)
  857. set(RunCMake_TEST_OPTIONS --profiling-output=/no/such/file.txt)
  858. run_cmake(profiling-missing-format)
  859. unset(RunCMake_TEST_OPTIONS)
  860. set(RunCMake_TEST_OPTIONS --profiling-format=google-trace)
  861. run_cmake(profiling-missing-output)
  862. unset(RunCMake_TEST_OPTIONS)
  863. set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/profiling-test")
  864. set(ProfilingTestOutput ${RunCMake_TEST_BINARY_DIR}/output.json)
  865. set(RunCMake_TEST_OPTIONS --profiling-format=google-trace --profiling-output=${ProfilingTestOutput})
  866. run_cmake(ProfilingTest)
  867. unset(RunCMake_TEST_OPTIONS)
  868. if(RunCMake_GENERATOR MATCHES "^Visual Studio 10 2010")
  869. run_cmake_with_options(DeprecateVS10-WARN-ON -DCMAKE_WARN_VS10=ON)
  870. unset(ENV{CMAKE_WARN_VS10})
  871. run_cmake(DeprecateVS10-WARN-ON)
  872. run_cmake_with_options(DeprecateVS10-WARN-OFF -DCMAKE_WARN_VS10=OFF)
  873. endif()