CMP0057-NEW.cmake 711 B

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