cmake/Tests/RunCMake/find_program/RunCMakeTest.cmake

65 lines
1.9 KiB
CMake
Raw Normal View History

2015-11-17 17:22:37 +01:00
include(RunCMake)
run_cmake(EnvAndHints)
run_cmake(DirsPerName)
run_cmake(NamesPerDir)
2018-10-28 12:09:07 +01:00
run_cmake(RelAndAbsPath)
2020-08-30 11:54:41 +02:00
run_cmake(Required)
2021-09-14 00:13:48 +02:00
run_cmake(NO_CACHE)
2022-03-29 21:10:50 +02:00
run_cmake(IgnorePrefixPath)
2022-08-04 22:12:04 +02:00
run_cmake(REGISTRY_VIEW-no-view)
run_cmake(REGISTRY_VIEW-wrong-view)
2022-11-16 20:14:03 +01:00
run_cmake(VALIDATOR-no-function)
run_cmake(VALIDATOR-undefined-function)
run_cmake(VALIDATOR-specify-macro)
run_cmake(VALIDATOR)
2015-11-17 17:22:37 +01:00
2021-09-14 00:13:48 +02:00
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
2015-11-17 17:22:37 +01:00
run_cmake(WindowsCom)
run_cmake(WindowsExe)
2020-08-30 11:54:41 +02:00
else()
# test non readable file only if not root
execute_process(
COMMAND id -u $ENV{USER}
OUTPUT_VARIABLE uid
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${uid}" STREQUAL "0")
2021-09-14 00:13:48 +02:00
run_cmake(CMP0109-WARN)
run_cmake(CMP0109-OLD)
run_cmake(CMP0109-NEW)
2020-08-30 11:54:41 +02:00
endif()
2015-11-17 17:22:37 +01:00
endif()
2021-09-14 00:13:48 +02:00
if(APPLE)
run_cmake(BundleSpaceInName)
endif()
2022-03-29 21:10:50 +02:00
run_cmake_with_options(EnvAndHintsDebugVar --debug-find-var=PROG)
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_program" /f OUTPUT_QUIET ERROR_QUIET)
if (ARCH STREQUAL "64bit")
execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_program" /f OUTPUT_QUIET ERROR_QUIET)
endif()
endif()
endif()