StaticAnalyzers.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF)
  2. option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
  3. option(ENABLE_INCLUDE_WHAT_YOU_USE "Enable static analysis with include-what-you-use" OFF)
  4. if(ENABLE_CPPCHECK)
  5. find_program(CPPCHECK cppcheck)
  6. if(CPPCHECK)
  7. set(CMAKE_CXX_CPPCHECK
  8. ${CPPCHECK}
  9. --suppress=missingInclude
  10. --enable=all
  11. --inline-suppr
  12. --inconclusive
  13. -i
  14. ${CMAKE_SOURCE_DIR}/imgui/lib)
  15. else()
  16. message(SEND_ERROR "cppcheck requested but executable not found")
  17. endif()
  18. endif()
  19. if(ENABLE_CLANG_TIDY)
  20. find_program(CLANGTIDY clang-tidy)
  21. if(CLANGTIDY)
  22. set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option)
  23. else()
  24. message(SEND_ERROR "clang-tidy requested but executable not found")
  25. endif()
  26. endif()
  27. if(ENABLE_INCLUDE_WHAT_YOU_USE)
  28. find_program(INCLUDE_WHAT_YOU_USE include-what-you-use)
  29. if(INCLUDE_WHAT_YOU_USE)
  30. set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE})
  31. else()
  32. message(SEND_ERROR "include-what-you-use requested but executable not found")
  33. endif()
  34. endif()