RunCMakeTest.cmake 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. include(RunCMake)
  2. run_cmake(EmptyOldStyle)
  3. run_cmake(FromPATHEnv)
  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. if(APPLE)
  10. run_cmake(FrameworksWithSubdirs)
  11. endif()
  12. run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=PATH_IN_ENV_PATH)
  13. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
  14. # Tests using the Windows registry
  15. find_program(REG NAMES "reg.exe" NO_CACHE)
  16. if (REG)
  17. ## check host architecture
  18. cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU" SUBKEYS VIEW 64 ERROR_VARIABLE status)
  19. if (status STREQUAL "")
  20. set(ARCH "64bit")
  21. else()
  22. set(ARCH "32bit")
  23. endif()
  24. # crete some entries in the registry
  25. cmake_path(CONVERT "${RunCMake_SOURCE_DIR}/registry_host${ARCH}.reg" TO_NATIVE_PATH_LIST registry_data)
  26. execute_process(COMMAND "${REG}" import "${registry_data}" OUTPUT_QUIET ERROR_QUIET)
  27. run_cmake_with_options(Registry-query -DARCH=${ARCH})
  28. # clean-up registry
  29. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\CLSID\\CMake-Tests\\find_path" /f OUTPUT_QUIET ERROR_QUIET)
  30. if (ARCH STREQUAL "64bit")
  31. execute_process(COMMAND "${REG}" delete "HKCU\\SOFTWARE\\Classes\\WOW6432Node\\CLSID\\CMake-Tests\\find_path" /f OUTPUT_QUIET ERROR_QUIET)
  32. endif()
  33. endif()
  34. endif()