option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF)
option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
option(ENABLE_CLANG_COVERAGE "Enable coverage collection with clang" OFF)

if(ENABLE_CPPCHECK)
  find_program(CPPCHECK cppcheck)
  if(CPPCHECK)
    set(CMAKE_CXX_CPPCHECK ${CPPCHECK} --suppress=missingInclude --enable=all
                           --inconclusive -i ${CMAKE_SOURCE_DIR}/imgui/lib)
  else()
    message(SEND_ERROR "cppcheck requested but executable not found")
  endif()
else()
  message("-- DISABLED - cppcheck")
endif()

if(ENABLE_CLANG_TIDY)
  find_program(CLANGTIDY clang-tidy)
  if(CLANGTIDY)
    set(CMAKE_CXX_CLANG_TIDY "${CLANGTIDY}")
    message("-- Using clang-tidy: ${CLANGTIDY}")
  else()
    message(SEND_ERROR "clang-tidy requested but executable not found")
  endif()
else()
  message("-- DISABLED - clang-tidy")
endif()

if (ENABLE_CLANG_COVERAGE)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -coverage -fprofile-instr-generate -fcoverage-mapping")
endif()
