RunCMakeTest.cmake 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. include(RunCMake)
  2. # Use an initial cache file to define the project() variables
  3. # to avoid long command lines. Also see the CMakeOnly test case
  4. # which tests some of the individual variables one at a time.
  5. # Here, we are focused on testing that the variables are all injected
  6. # at the expected points in the expected order.
  7. run_cmake_with_options(CodeInjection1
  8. -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_1.cmake"
  9. )
  10. # This checks that List variables are allowed.
  11. run_cmake_with_options(CodeInjection2
  12. -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_2.cmake"
  13. )
  14. # This checks that module names are also allowed.
  15. run_cmake_with_options(CodeInjection3
  16. -C "${CMAKE_CURRENT_LIST_DIR}/CodeInjection/initial_cache_3.cmake"
  17. )
  18. if(CMake_TEST_RESOURCES)
  19. run_cmake(ExplicitRC)
  20. endif()
  21. run_cmake(KeywordProjectName)
  22. set(RunCMake_DEFAULT_stderr .)
  23. run_cmake(LanguagesDuplicate)
  24. unset(RunCMake_DEFAULT_stderr)
  25. run_cmake(LanguagesImplicit)
  26. run_cmake(LanguagesEmpty)
  27. run_cmake(LanguagesNONE)
  28. run_cmake(LanguagesTwice)
  29. run_cmake(LanguagesUnordered)
  30. if(RunCMake_GENERATOR MATCHES "Make|Ninja")
  31. run_cmake(LanguagesUsedButNotEnabled)
  32. endif()
  33. run_cmake(ProjectCMP0126)
  34. run_cmake(ProjectDescription)
  35. run_cmake(ProjectDescription2)
  36. run_cmake(ProjectDescriptionNoArg)
  37. run_cmake(ProjectDescriptionNoArg2)
  38. run_cmake(ProjectHomepage)
  39. run_cmake(ProjectHomepage2)
  40. run_cmake(ProjectHomepageNoArg)
  41. run_cmake(ProjectIsTopLevel)
  42. run_cmake(ProjectIsTopLevelMultiple)
  43. run_cmake(ProjectIsTopLevelSubdirectory)
  44. run_cmake(ProjectTwice)
  45. run_cmake(Omissions)
  46. run_cmake(VersionAndLanguagesEmpty)
  47. run_cmake(VersionEmpty)
  48. run_cmake(VersionInvalid)
  49. run_cmake(VersionMissingLanguages)
  50. run_cmake(VersionMissingValueOkay)
  51. run_cmake(VersionTwice)
  52. run_cmake(VersionMax)
  53. set(opts
  54. "-DCMAKE_EXPERIMENTAL_EXPORT_PACKAGE_INFO=b80be207-778e-46ba-8080-b23bba22639e"
  55. "-Wno-dev"
  56. )
  57. run_cmake_with_options(ProjectCompatVersion ${opts})
  58. run_cmake_with_options(ProjectCompatVersion2 ${opts})
  59. run_cmake_with_options(ProjectCompatVersionEqual ${opts})
  60. run_cmake_with_options(ProjectCompatVersionInvalid ${opts})
  61. run_cmake_with_options(ProjectCompatVersionMissingVersion ${opts})
  62. run_cmake_with_options(ProjectCompatVersionNewer ${opts})
  63. run_cmake_with_options(ProjectCompatVersionNoArg ${opts})
  64. run_cmake(CMP0048-NEW)
  65. run_cmake(CMP0096-WARN)
  66. run_cmake(CMP0096-OLD)
  67. run_cmake(CMP0096-NEW)
  68. # We deliberately run these twice to verify behavior of the second CMake run
  69. run_cmake(CMP0180-OLD)
  70. set(RunCMake_TEST_NO_CLEAN 1)
  71. run_cmake(CMP0180-OLD)
  72. set(RunCMake_TEST_NO_CLEAN 0)
  73. run_cmake(CMP0180-NEW)
  74. set(RunCMake_TEST_NO_CLEAN 1)
  75. run_cmake(CMP0180-NEW)
  76. set(RunCMake_TEST_NO_CLEAN 0)
  77. run_cmake(NoMinimumRequired)