RunCMakeTest.cmake 4.5 KB

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