RunCMakeTest.cmake 4.3 KB

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