Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / find_path / RunCMakeTest.cmake
1 include(RunCMake)
2
3 run_cmake(EmptyOldStyle)
4 run_cmake(FromPATHEnv)
5 run_cmake(PrefixInPATH)
6 run_cmake(Required)
7 run_cmake(NO_CACHE)
8 run_cmake(REGISTRY_VIEW-no-view)
9 run_cmake(REGISTRY_VIEW-wrong-view)
10 run_cmake(VALIDATOR-no-function)
11 run_cmake(VALIDATOR-undefined-function)
12 run_cmake(VALIDATOR-specify-macro)
13 run_cmake(VALIDATOR)
14
15 if(APPLE)
16   run_cmake(FrameworksWithSubdirs)
17 endif()
18
19 run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=PATH_IN_ENV_PATH)
20
21 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
22   # Tests using the Windows registry
23   find_program(REG NAMES "reg.exe" NO_CACHE)
24   if (REG)
25     ## check host architecture
26     cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
27     if (status STREQUAL "")
28       set(ARCH "64bit")
29     else()
30       set(ARCH "32bit")
31     endif()
32
33     # crete some entries in the registry
34     cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
35     execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
36
37     run_cmake_with_options(Registry-query -DARCH=${ARCH})
38
39     # clean-up registry
40     execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_path" /f OUTPUT_QUIET ERROR_QUIET)
41     if (ARCH STREQUAL "64bit")
42       execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_path" /f OUTPUT_QUIET ERROR_QUIET)
43     endif()
44   endif()
45 endif()