ParentScope.cmake 693 B

123456789101112131415161718192021222324252627282930313233
  1. set(FOO )
  2. set(BAR "bar")
  3. set(BAZ "baz")
  4. set(BOO "boo")
  5. function(_parent_scope)
  6. set(FOO "foo" PARENT_SCOPE)
  7. set(BAR "" PARENT_SCOPE)
  8. set(BAZ PARENT_SCOPE)
  9. unset(BOO PARENT_SCOPE)
  10. endfunction()
  11. _parent_scope()
  12. if(NOT DEFINED FOO)
  13. message(FATAL_ERROR "FOO not defined")
  14. elseif(NOT "${FOO}" STREQUAL "foo")
  15. message(FATAL_ERROR "FOO should be \"foo\", not \"${FOO}\"")
  16. endif()
  17. if(NOT DEFINED BAR)
  18. message(FATAL_ERROR "BAR not defined")
  19. elseif(NOT "${BAR}" STREQUAL "")
  20. message(FATAL_ERROR "BAR should be an empty string, not \"${BAR}\"")
  21. endif()
  22. if(DEFINED BAZ)
  23. message(FATAL_ERROR "BAZ defined")
  24. endif()
  25. if(DEFINED BOO)
  26. message(FATAL_ERROR "BOO defined")
  27. endif()