mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
Adding support for clang-format (#94)
This commit is contained in:
34
cmake/FindClangFormat.cmake
Normal file
34
cmake/FindClangFormat.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# Find Clang format
|
||||
#
|
||||
#
|
||||
if(NOT ClangFormat_BIN_NAME)
|
||||
set(ClangFormat_BIN_NAME clang-format)
|
||||
endif()
|
||||
|
||||
# if custom path check there first
|
||||
if(ClangFormat_ROOT_DIR)
|
||||
find_program(ClangFormat_BIN
|
||||
NAMES
|
||||
${ClangFormat_BIN_NAME}
|
||||
PATHS
|
||||
"${ClangFormat_ROOT_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
find_program(ClangFormat_BIN NAMES ${ClangFormat_BIN_NAME})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
ClangFormat
|
||||
DEFAULT_MSG
|
||||
ClangFormat_BIN)
|
||||
|
||||
mark_as_advanced(
|
||||
ClangFormat_BIN)
|
||||
|
||||
if(ClangFormat_FOUND)
|
||||
# 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()
|
Reference in New Issue
Block a user