Disallow clang-format version 15 and newer
This commit is contained in:
parent
c5bd4a4063
commit
8c6b578012
@ -532,7 +532,7 @@ if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires minimum version 12")
|
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 12, 13, or 14")
|
||||||
add_custom_target(format
|
add_custom_target(format
|
||||||
COMMAND ${CMAKE_COMMAND} "-DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE}" -P ./cmake/Format.cmake
|
COMMAND ${CMAKE_COMMAND} "-DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE}" -P ./cmake/Format.cmake
|
||||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM)
|
||||||
|
@ -13,10 +13,12 @@ endif()
|
|||||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
|
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
|
||||||
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
|
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
|
||||||
unset(CLANG_FORMAT_VERSION)
|
unset(CLANG_FORMAT_VERSION)
|
||||||
if(CMAKE_MATCH_1 GREATER_EQUAL 12)
|
if(CMAKE_MATCH_1 LESS 12)
|
||||||
message(STATUS "Using clang-format version ${CMAKE_MATCH_1}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} is too low")
|
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} is too low")
|
||||||
|
elseif(CMAKE_MATCH_1 GREATER 14)
|
||||||
|
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} is too high")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using clang-format version ${CMAKE_MATCH_1}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
|
Loading…
Reference in New Issue
Block a user