CMP0057-NEW.cmake 680 B

1234567891011121314151617181920212223242526272829
  1. set(MY_NON_EXISTENT_LIST)
  2. set(MY_EMPTY_LIST "")
  3. set(MY_LIST foo bar)
  4. if(NOT "foo" IN_LIST MY_LIST)
  5. message(FATAL_ERROR "expected item 'foo' not found in list MY_LIST")
  6. endif()
  7. if("baz" IN_LIST MY_LIST)
  8. message(FATAL_ERROR "unexpected item 'baz' found in list MY_LIST")
  9. endif()
  10. if("foo" IN_LIST MY_NON_EXISTENT_LIST)
  11. message(FATAL_ERROR
  12. "unexpected item 'baz' found in non existent list MY_NON_EXISTENT_LIST")
  13. endif()
  14. if("foo" IN_LIST MY_EMPTY_LIST)
  15. message(FATAL_ERROR
  16. "unexpected item 'baz' found in empty list MY_EMPTY_LIST")
  17. endif()
  18. set(VAR "foo")
  19. if(NOT VAR IN_LIST MY_LIST)
  20. message(FATAL_ERROR "expected item VAR not found in list MY_LIST")
  21. endif()