GetPropertyTest.cmake.in 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
  2. get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS)
  3. get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS)
  4. if (NOT FOO_BRIEF STREQUAL "NOTFOUND")
  5. message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'")
  6. endif ()
  7. if (NOT FOO_FULL STREQUAL "NOTFOUND")
  8. message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'")
  9. endif ()
  10. get_property(test_brief GLOBAL PROPERTY ENABLED_FEATURES BRIEF_DOCS)
  11. get_property(test_full GLOBAL PROPERTY ENABLED_FEATURES FULL_DOCS)
  12. if(test_brief STREQUAL "NOTFOUND")
  13. message(SEND_ERROR "property ENABLED_FEATURES has no BRIEF_DOCS")
  14. endif()
  15. if(test_full STREQUAL "NOTFOUND")
  16. message(SEND_ERROR "property ENABLED_FEATURES has no FULL_DOCS")
  17. endif()
  18. set(test_var alpha)
  19. get_property(result VARIABLE PROPERTY test_var)
  20. if(NOT result STREQUAL "alpha")
  21. message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'")
  22. endif()
  23. set(Missing-Argument-RESULT 1)
  24. set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*")
  25. check_cmake_test(GetProperty
  26. Missing-Argument
  27. )
  28. set(Bad-Scope-RESULT 1)
  29. set(Bad-Scope-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*")
  30. check_cmake_test(GetProperty
  31. Bad-Scope
  32. )
  33. set(Bad-Argument-RESULT 1)
  34. set(Bad-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*")
  35. check_cmake_test(GetProperty
  36. Bad-Argument
  37. )
  38. set(No-Property-RESULT 1)
  39. set(No-Property-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY <name> argument\\..*")
  40. check_cmake_test(GetProperty
  41. No-Property
  42. )
  43. set(Global-Name-RESULT 1)
  44. set(Global-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*")
  45. check_cmake_test(GetProperty
  46. Global-Name
  47. )
  48. set(Bad-Directory-RESULT 1)
  49. set(Bad-Directory-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*")
  50. check_cmake_test(GetProperty
  51. Bad-Directory
  52. )
  53. set(No-Target-RESULT 1)
  54. set(No-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*")
  55. check_cmake_test(GetProperty
  56. No-Target
  57. )
  58. set(Bad-Target-RESULT 1)
  59. set(Bad-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*")
  60. check_cmake_test(GetProperty
  61. Bad-Target
  62. )
  63. set(No-Source-RESULT 1)
  64. set(No-Source-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*")
  65. check_cmake_test(GetProperty
  66. No-Source
  67. )
  68. set(No-Test-RESULT 1)
  69. set(No-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*")
  70. check_cmake_test(GetProperty
  71. No-Test
  72. )
  73. set(Bad-Test-RESULT 1)
  74. set(Bad-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*")
  75. check_cmake_test(GetProperty
  76. Bad-Test
  77. )
  78. set(Variable-Name-RESULT 1)
  79. set(Variable-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*")
  80. check_cmake_test(GetProperty
  81. Variable-Name
  82. )
  83. set(No-Cache-RESULT 1)
  84. set(No-Cache-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*")
  85. check_cmake_test(GetProperty
  86. No-Cache
  87. )