RunCMakeTest.cmake 2.0 KB

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