FindClangTools.cmake 1006 B

12345678910111213141516171819202122232425262728293031323334
  1. # Find Clang Tools
  2. #
  3. # This module defines
  4. # CLANG_TIDY_PROGRAM, The path to the clang tidy binary
  5. # CLANG_TIDY_FOUND, Whether clang tidy was found
  6. # CLANG_FORMAT_PROGRAM, The path to the clang format binary
  7. # CLANG_FORMAT_FOUND, Whether clang format was found
  8. find_program(CLANG_TIDY_PROGRAM
  9. NAMES clang-tidy-3.9 clang-tidy-3.8 clang-tidy-3.7 clang-tidy-3.6 clang-tidy
  10. PATHS $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin
  11. NO_DEFAULT_PATH)
  12. mark_as_advanced(CLANG_TIDY_PROGRAM)
  13. if("${CLANG_TIDY_PROGRAM}" STREQUAL "CLANG_TIDY_PROGRAM-NOTFOUND")
  14. set(CLANG_TIDY_FOUND 0)
  15. else()
  16. set(CLANG_TIDY_FOUND 1)
  17. endif()
  18. find_program(CLANG_FORMAT_PROGRAM
  19. NAMES clang-format 3.9 clang-format-3.8 clang-format-3.7 clang-format-3.6 clang-format
  20. PATHS $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin
  21. NO_DEFAULT_PATH)
  22. mark_as_advanced(CLANG_FORMAT_PROGRAM)
  23. if("${CLANG_FORMAT_PROGRAM}" STREQUAL "CLANG_FORMAT_PROGRAM-NOTFOUND")
  24. set(CLANG_FORMAT_FOUND 0)
  25. else()
  26. set(CLANG_FORMAT_FOUND 1)
  27. endif()