RunCMakeTest.cmake 4.1 KB

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