Debian Codegraph @

Tests/RunCMake/find_program/RunCMakeTest.cmake

raw
1 include(RunCMake)
2
3 run_cmake(ConfigureLogTransitions)
4 run_cmake(ConfigureLogTransitionsSuppressed)
5 run_cmake(EnvAndHints)
6 run_cmake(DirsPerName)
7 run_cmake(NamesPerDir)
8 run_cmake(RelAndAbsPath)
9 run_cmake(Required)
10 run_cmake(Optional)
11 run_cmake(NO_CACHE)
12 run_cmake(IgnorePrefixPath)
13 run_cmake(REGISTRY_VIEW-no-view)
14 run_cmake(REGISTRY_VIEW-wrong-view)
15 run_cmake(VALIDATOR-no-function)
16 run_cmake(VALIDATOR-undefined-function)
17 run_cmake(VALIDATOR-specify-macro)
18 run_cmake(VALIDATOR)
19
20 if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
21 run_cmake(WindowsCom)
22 run_cmake(WindowsExe)
23 else()
24 # test non readable file only if not root
25 execute_process(
26 COMMAND id -u $ENV{USER}
27 OUTPUT_VARIABLE uid
28 OUTPUT_STRIP_TRAILING_WHITESPACE)
29
30 if(NOT "${uid}" STREQUAL "0")
31 run_cmake(CMP0109-WARN)
32 run_cmake(CMP0109-OLD)
33 run_cmake(CMP0109-NEW)
34 endif()
35 endif()
36
37 if(APPLE)
38 run_cmake(BundleSpaceInName)
39 endif()
40
41 run_cmake_with_options(EnvAndHintsDebugVar --debug-find-var=PROG)
42
43 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
44 # Tests using the Windows registry
45 find_program(REG NAMES "reg.exe" NO_CACHE)
46 if (REG)
47 ## check host architecture
48 cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
49 if (status STREQUAL "")
50 set(ARCH "64bit")
51 else()
52 set(ARCH "32bit")
53 endif()
54
55 # crete some entries in the registry
56 cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
57 execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
58
59 run_cmake_with_options(Registry-query -DARCH=${ARCH})
60
61 # clean-up registry
62 execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_program" /f OUTPUT_QUIET ERROR_QUIET)
63 if (ARCH STREQUAL "64bit")
64 execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_program" /f OUTPUT_QUIET ERROR_QUIET)
65 endif()
66 endif()
67 endif()