example.cmake 811 B

1234567891011121314151617181920212223242526272829303132
  1. target_compile_options(${PROJECT} PUBLIC
  2. -Wall
  3. -Wextra
  4. -Werror
  5. -Wfatal-errors
  6. -Wdouble-promotion
  7. -Wfloat-equal
  8. -Wshadow
  9. -Wwrite-strings
  10. -Wsign-compare
  11. -Wmissing-format-attribute
  12. -Wunreachable-code
  13. -Wcast-align
  14. -Wcast-qual
  15. -Wnull-dereference
  16. -Wuninitialized
  17. -Wunused
  18. -Wredundant-decls
  19. #-Wstrict-prototypes
  20. #-Werror-implicit-function-declaration
  21. #-Wundef
  22. )
  23. # GCC 10
  24. if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
  25. target_compile_options(${PROJECT} PUBLIC -Wconversion)
  26. endif()
  27. # GCC 8
  28. if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
  29. target_compile_options(${PROJECT} PUBLIC -Wcast-function-type -Wstrict-overflow)
  30. endif()