mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
check for clang-format version
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
# Find Clang format
|
||||
#
|
||||
#
|
||||
if(NOT ClangFormat_BIN_NAME)
|
||||
set(ClangFormat_BIN_NAME clang-format)
|
||||
endif()
|
||||
@ -27,8 +25,15 @@ 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)
|
||||
EXEC_PROGRAM(${ClangFormat_BIN} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION)
|
||||
STRING(REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CLANG_MAJOR_VERSION ${CLANG_VERSION})
|
||||
if((${CLANG_MAJOR_VERSION} GREATER "9") OR (${CLANG_MAJOR_VERSION} EQUAL "9"))
|
||||
# A CMake script to find all source files and setup clang-format targets for them
|
||||
message(STATUS "found clang-format ${CLANG_VERSION} adding formatting targets")
|
||||
include(clang-format)
|
||||
else()
|
||||
message(STATUS "clang-format version ${CLANG_VERSION} found but need at least 9. Not setting up format targets")
|
||||
endif()
|
||||
else()
|
||||
message("clang-format not found. Not setting up format targets")
|
||||
message(STATUS "clang-format not found. Not setting up format targets")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user