cmake/Tests/RunCMake/find_package/RunCMakeTest.cmake

140 lines
4.3 KiB
CMake
Raw Normal View History

2012-04-19 19:04:21 +03:00
include(RunCMake)
2018-08-09 18:06:22 +02:00
run_cmake(CMP0074-WARN)
run_cmake(CMP0074-OLD)
2012-04-19 19:04:21 +03:00
run_cmake(ComponentRequiredAndOptional)
2020-02-01 23:06:01 +01:00
run_cmake(FromPATHEnv)
2022-03-29 21:10:50 +02:00
run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)
2020-02-01 23:06:01 +01:00
run_cmake(FromPrefixPath)
2022-08-04 22:12:04 +02:00
run_cmake(GlobalImportTarget)
2012-04-19 19:04:21 +03:00
run_cmake(MissingNormal)
2021-11-20 13:41:27 +01:00
run_cmake(MissingNormalForceRequired)
2012-04-19 19:04:21 +03:00
run_cmake(MissingNormalRequired)
run_cmake(MissingNormalVersion)
run_cmake(MissingNormalWarnNoModuleOld)
run_cmake(MissingNormalWarnNoModuleNew)
run_cmake(MissingModule)
run_cmake(MissingModuleRequired)
run_cmake(MissingConfig)
2020-08-30 11:54:41 +02:00
run_cmake(MissingConfigDebug)
2022-03-29 21:10:50 +02:00
run_cmake_with_options(MissingConfigDebugPkg --debug-find-pkg=NotHere)
2012-04-19 19:04:21 +03:00
run_cmake(MissingConfigOneName)
run_cmake(MissingConfigRequired)
run_cmake(MissingConfigVersion)
run_cmake(MixedModeOptions)
2022-03-29 21:10:50 +02:00
run_cmake_with_options(ModuleModeDebugPkg --debug-find-pkg=Foo,Zot)
2017-07-20 19:35:53 +02:00
run_cmake(PackageRoot)
2017-08-11 09:33:23 +02:00
run_cmake(PackageRootNestedConfig)
run_cmake(PackageRootNestedModule)
2015-12-03 18:43:53 +01:00
run_cmake(PolicyPush)
run_cmake(PolicyPop)
2021-11-20 13:41:27 +01:00
run_cmake(RequiredOptionValuesClash)
2022-03-29 21:10:50 +02:00
run_cmake(FindRootPathAndPrefixPathAreEqual)
2012-04-19 19:04:21 +03:00
run_cmake(SetFoundFALSE)
2017-07-20 19:35:53 +02:00
run_cmake(WrongVersion)
run_cmake(WrongVersionConfig)
2019-11-11 23:01:05 +01:00
run_cmake(CMP0084-OLD)
run_cmake(CMP0084-WARN)
run_cmake(CMP0084-NEW)
2023-07-02 19:51:09 +02:00
run_cmake(CMP0145-OLD)
run_cmake(CMP0145-WARN)
run_cmake(CMP0145-NEW)
run_cmake(CMP0146-OLD)
run_cmake(CMP0146-WARN)
run_cmake(CMP0146-NEW)
if(RunCMake_GENERATOR MATCHES "Visual Studio")
run_cmake(CMP0147-OLD)
run_cmake(CMP0147-WARN)
run_cmake(CMP0147-NEW)
endif()
run_cmake(CMP0148-Interp-OLD)
run_cmake(CMP0148-Interp-WARN)
run_cmake(CMP0148-Interp-NEW)
run_cmake(CMP0148-Libs-OLD)
run_cmake(CMP0148-Libs-WARN)
run_cmake(CMP0148-Libs-NEW)
2024-07-09 14:46:46 +02:00
run_cmake(CMP0167-OLD)
run_cmake(CMP0167-WARN)
run_cmake(CMP0167-NEW)
2021-09-14 00:13:48 +02:00
run_cmake(WrongVersionRange)
run_cmake(EmptyVersionRange)
run_cmake(VersionRangeWithEXACT)
run_cmake(VersionRange)
run_cmake(VersionRange2)
run_cmake(VersionRange3)
run_cmake(VersionRange4)
run_cmake(VersionRangeConfig)
run_cmake(VersionRangeConfig2)
run_cmake(VersionRangeConfig02)
run_cmake(VersionRangeConfigStd)
run_cmake(VersionRangeConfigStd2)
2022-08-04 22:12:04 +02:00
run_cmake_with_options(IgnoreInstallPrefix "-DCMAKE_INSTALL_PREFIX=${RunCMake_SOURCE_DIR}/PackageRoot/foo/cmake_root")
2022-03-29 21:10:50 +02:00
run_cmake(IgnorePath)
run_cmake(IgnorePrefixPath)
2022-08-04 22:12:04 +02:00
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
run_cmake(REGISTRY_VIEW-propagated)
2023-12-07 09:12:54 +01:00
if(CMAKE_HOST_WIN32 AND MINGW)
run_cmake(MSYSTEM_PREFIX)
endif()
2023-07-02 19:51:09 +02:00
if(CMAKE_HOST_WIN32)
run_cmake(CMP0144-WARN-CaseInsensitive)
run_cmake(CMP0144-OLD-CaseInsensitive)
run_cmake(CMP0144-NEW-CaseInsensitive)
else()
run_cmake(CMP0144-WARN-CaseSensitive)
run_cmake(CMP0144-WARN-CaseSensitive-Mixed)
run_cmake(CMP0144-OLD-CaseSensitive)
run_cmake(CMP0144-NEW-CaseSensitive)
endif()
2022-11-16 20:14:03 +01:00
file(
GLOB SearchPaths_TEST_CASE_LIST
LIST_DIRECTORIES TRUE
"${RunCMake_SOURCE_DIR}/SearchPaths/*"
)
foreach(TestCasePrefix IN LISTS SearchPaths_TEST_CASE_LIST)
if(IS_DIRECTORY "${TestCasePrefix}")
cmake_path(GET TestCasePrefix FILENAME TestSuffix)
run_cmake_with_options(
SearchPaths_${TestSuffix}
"-DSearchPaths_ROOT=${TestCasePrefix}"
"--debug-find-pkg=SearchPaths"
)
endif()
endforeach()
2021-09-14 00:13:48 +02:00
if(UNIX
AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
)
2019-11-11 23:01:05 +01:00
run_cmake(SetFoundResolved)
endif()
2022-08-04 22:12:04 +02:00
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
# Tests using the Windows registry
find_program(REG NAMES "reg.exe" NO_CACHE)
if (REG)
## check host architecture
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
if (status STREQUAL "")
set(ARCH "64bit")
else()
set(ARCH "32bit")
endif()
# crete some entries in the registry
cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
run_cmake_with_options(Registry-query -DARCH=${ARCH})
# clean-up registry
execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_package" /f OUTPUT_QUIET ERROR_QUIET)
if (ARCH STREQUAL "64bit")
execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_package" /f OUTPUT_QUIET ERROR_QUIET)
endif()
endif()
endif()