RunCMakeTest.cmake 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. include(RunCMake)
  2. run_cmake(CMP0074-WARN)
  3. run_cmake(CMP0074-OLD)
  4. run_cmake(ComponentRecursion)
  5. run_cmake(ComponentRequiredAndOptional)
  6. run_cmake(ConfigureLog)
  7. # Two tests because the stderr regex otherwise takes way too long to load.
  8. run_cmake(ConfigureLogParameters1)
  9. run_cmake(ConfigureLogParameters2)
  10. run_cmake(ConfigureLogTransitionsConfig) # with `CONFIG`
  11. run_cmake(ConfigureLogTransitionsConfigSuppressed)
  12. run_cmake(ConfigureLogTransitionsConfig2) # without `CONFIG`, finding config
  13. run_cmake(ConfigureLogTransitionsConfig2Suppressed)
  14. run_cmake(ConfigureLogTransitionsModule) # with `MODULE`
  15. run_cmake(ConfigureLogTransitionsModule2) # without `MODULE`, finding module
  16. run_cmake(ConfigureLogTransitionsModule2Suppressed)
  17. run_cmake(EmptyRoots)
  18. run_cmake(FromPATHEnv)
  19. run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)
  20. run_cmake(FromPrefixPath)
  21. run_cmake(GlobalImportTarget)
  22. run_cmake(MissingNormal)
  23. run_cmake(MissingNormalForceRequired)
  24. run_cmake(MissingNormalRequired)
  25. run_cmake(MissingNormalVersion)
  26. run_cmake(MissingNormalWarnNoModuleOld)
  27. run_cmake(MissingNormalWarnNoModuleNew)
  28. run_cmake(MissingModule)
  29. run_cmake(MissingModuleRequired)
  30. run_cmake(MissingConfig)
  31. run_cmake(MissingConfigDebug)
  32. run_cmake_with_options(MissingConfigDebugPkg --debug-find-pkg=NotHere)
  33. run_cmake(MissingConfigOneName)
  34. run_cmake(MissingConfigRequired)
  35. run_cmake(MissingConfigVersion)
  36. run_cmake(MixedModeOptions)
  37. run_cmake_with_options(ModuleModeDebugPkg --debug-find-pkg=Foo,Zot)
  38. run_cmake(PackageRoot)
  39. run_cmake(PackageRootNestedConfig)
  40. run_cmake(PackageRootNestedModule)
  41. run_cmake(PackageVarOverridesOptional)
  42. run_cmake(PolicyPush)
  43. run_cmake(PolicyPop)
  44. run_cmake(RequiredOptionValuesClash)
  45. run_cmake(RequiredOptionalKeywordsClash)
  46. run_cmake(RequiredVarOptional)
  47. run_cmake(RequiredVarNested)
  48. run_cmake(FindRootPathAndPrefixPathAreEqual)
  49. run_cmake(SetFoundFALSE)
  50. run_cmake(WrongVersion)
  51. run_cmake(WrongVersionConfig)
  52. run_cmake(CMP0084-OLD)
  53. run_cmake(CMP0084-WARN)
  54. run_cmake(CMP0084-NEW)
  55. run_cmake(CMP0145-OLD)
  56. run_cmake(CMP0145-WARN)
  57. run_cmake(CMP0145-NEW)
  58. run_cmake(CMP0146-OLD)
  59. run_cmake(CMP0146-WARN)
  60. run_cmake(CMP0146-NEW)
  61. if(RunCMake_GENERATOR MATCHES "Visual Studio")
  62. run_cmake(CMP0147-OLD)
  63. run_cmake(CMP0147-WARN)
  64. run_cmake(CMP0147-NEW)
  65. endif()
  66. run_cmake(CMP0148-Interp-OLD)
  67. run_cmake(CMP0148-Interp-WARN)
  68. run_cmake(CMP0148-Interp-NEW)
  69. run_cmake(CMP0148-Libs-OLD)
  70. run_cmake(CMP0148-Libs-WARN)
  71. run_cmake(CMP0148-Libs-NEW)
  72. run_cmake(CMP0167-OLD)
  73. run_cmake(CMP0167-WARN)
  74. run_cmake(CMP0167-NEW)
  75. run_cmake(CMP0188-OLD)
  76. run_cmake(CMP0188-WARN)
  77. run_cmake(CMP0188-NEW)
  78. run_cmake(CMP0191-OLD)
  79. run_cmake(CMP0191-WARN)
  80. run_cmake(CMP0191-NEW)
  81. run_cmake(WrongVersionRange)
  82. run_cmake(EmptyVersionRange)
  83. run_cmake(VersionRangeWithEXACT)
  84. run_cmake(VersionRange)
  85. run_cmake(VersionRange2)
  86. run_cmake(VersionRange3)
  87. run_cmake(VersionRange4)
  88. run_cmake(VersionRangeConfig)
  89. run_cmake(VersionRangeConfig2)
  90. run_cmake(VersionRangeConfig02)
  91. run_cmake(VersionRangeConfigStd)
  92. run_cmake(VersionRangeConfigStd2)
  93. run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_SOURCE_DIR}/PackageRoot/foo/cmake_root")
  94. run_cmake(IgnorePath)
  95. run_cmake(IgnorePrefixPath)
  96. run_cmake(REGISTRY_VIEW-no-view)
  97. run_cmake(REGISTRY_VIEW-wrong-view)
  98. run_cmake(REGISTRY_VIEW-propagated)
  99. run_cmake(DebugRoot)
  100. run_cmake(ParentVariable)
  101. if(CMAKE_HOST_WIN32 AND MINGW)
  102. run_cmake(MSYSTEM_PREFIX)
  103. endif()
  104. if(CMAKE_HOST_WIN32)
  105. run_cmake(CMP0144-WARN-CaseInsensitive)
  106. run_cmake(CMP0144-OLD-CaseInsensitive)
  107. run_cmake(CMP0144-NEW-CaseInsensitive)
  108. else()
  109. run_cmake(CMP0144-WARN-CaseSensitive)
  110. run_cmake(CMP0144-WARN-CaseSensitive-Mixed)
  111. run_cmake(CMP0144-OLD-CaseSensitive)
  112. run_cmake(CMP0144-NEW-CaseSensitive)
  113. endif()
  114. file(
  115. GLOB SearchPaths_TEST_CASE_LIST
  116. LIST_DIRECTORIES TRUE
  117. "${RunCMake_SOURCE_DIR}/SearchPaths/*"
  118. )
  119. foreach(TestCasePrefix IN LISTS SearchPaths_TEST_CASE_LIST)
  120. if(IS_DIRECTORY "${TestCasePrefix}")
  121. cmake_path(GET TestCasePrefix FILENAME TestSuffix)
  122. run_cmake_with_options(
  123. SearchPaths_${TestSuffix}
  124. "-DSearchPaths_ROOT=${TestCasePrefix}"
  125. "--debug-find-pkg=SearchPaths"
  126. )
  127. endif()
  128. endforeach()
  129. if(UNIX
  130. AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
  131. )
  132. run_cmake(SetFoundResolved)
  133. endif()
  134. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
  135. # Tests using the Windows registry
  136. find_program(REG NAMES "reg.exe" NO_CACHE)
  137. if (REG)
  138. ## check host architecture
  139. cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
  140. if (status STREQUAL "")
  141. set(ARCH "64bit")
  142. else()
  143. set(ARCH "32bit")
  144. endif()
  145. # crete some entries in the registry
  146. cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
  147. execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
  148. run_cmake_with_options(Registry-query -DARCH=${ARCH})
  149. # clean-up registry
  150. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_package" /f OUTPUT_QUIET ERROR_QUIET)
  151. if (ARCH STREQUAL "64bit")
  152. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_package" /f OUTPUT_QUIET ERROR_QUIET)
  153. endif()
  154. endif()
  155. endif()