RunCMakeTest.cmake 1.9 KB

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