2019-02-23 19:40:34 +00:00
|
|
|
# Find Clang format
|
|
|
|
#
|
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
set(ClangFormat_BIN_NAME
|
2019-02-23 19:40:34 +00:00
|
|
|
clang-format
|
|
|
|
clang-format-5.0
|
|
|
|
clang-format-6.0
|
2019-02-23 22:13:33 +00:00
|
|
|
clang-format-7
|
2021-01-24 01:28:22 +00:00
|
|
|
clang-format-8
|
|
|
|
clang-format-9
|
|
|
|
clang-format-10
|
|
|
|
clang-format-11)
|
2019-02-23 19:40:34 +00:00
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
find_program(ClangFormat_BIN NAMES ${ClangFormat_BIN_NAME})
|
2019-02-23 19:40:34 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2021-01-24 00:22:47 +00:00
|
|
|
find_package_handle_standard_args(ClangFormat DEFAULT_MSG ClangFormat_BIN)
|
2019-02-23 19:40:34 +00:00
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
mark_as_advanced(ClangFormat_BIN)
|
2019-02-23 19:40:34 +00:00
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
if(ClangFormat_FOUND)
|
2019-02-23 19:40:34 +00:00
|
|
|
# A CMake script to find all source files and setup clang-format targets for
|
|
|
|
# them
|
|
|
|
include(clang-format)
|
|
|
|
else()
|
|
|
|
message("clang-format not found. Not setting up format targets")
|
|
|
|
endif()
|