RunCMakeTest.cmake 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. include(RunCMake)
  2. run_cmake(FromPATHEnv)
  3. run_cmake(FromPrefixPath)
  4. run_cmake(PrefixInPATH)
  5. run_cmake(Required)
  6. run_cmake(NO_CACHE)
  7. run_cmake(REGISTRY_VIEW-no-view)
  8. run_cmake(REGISTRY_VIEW-wrong-view)
  9. run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=PrefixInPATH_File)
  10. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
  11. # Tests using the Windows registry
  12. find_program(REG NAMES "reg.exe" NO_CACHE)
  13. if (REG)
  14. ## check host architecture
  15. cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
  16. if (status STREQUAL "")
  17. set(ARCH "64bit")
  18. else()
  19. set(ARCH "32bit")
  20. endif()
  21. # crete some entries in the registry
  22. cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
  23. execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
  24. run_cmake_with_options(Registry-query -DARCH=${ARCH})
  25. # clean-up registry
  26. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_file" /f OUTPUT_QUIET ERROR_QUIET)
  27. if (ARCH STREQUAL "64bit")
  28. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_file" /f OUTPUT_QUIET ERROR_QUIET)
  29. endif()
  30. endif()
  31. endif()