mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-29 08:48:48 +08:00
mdbx-make: don't use clang-format < 10 to avoid misformating.
Change-Id: I58d3b5071011a106b1801a1bd966f5c2d8354fcb
This commit is contained in:
parent
bc9c5bad5d
commit
c99f258a47
@ -253,17 +253,23 @@ else()
|
||||
add_custom_target(ctags DEPENDS tags)
|
||||
endif(CTAGS)
|
||||
|
||||
# Enable 'make reformat' target.
|
||||
find_program(CLANG_FORMAT
|
||||
NAMES clang-format-11.0 clang-format-10.0 clang-format-9.0 clang-format-8.0 clang-format)
|
||||
if(CLANG_FORMAT AND UNIX)
|
||||
add_custom_target(reformat
|
||||
VERBATIM
|
||||
COMMAND
|
||||
git ls-files |
|
||||
grep -E \\.\(c|cxx|cc|cpp|h|hxx|hpp\)\(\\.in\)?\$ |
|
||||
xargs ${CLANG_FORMAT} -i --style=file
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
if(UNIX)
|
||||
find_program(CLANG_FORMAT
|
||||
NAMES clang-format-12 clang-format-11 clang-format-10 clang-format)
|
||||
if(CLANG_FORMAT)
|
||||
execute_process(COMMAND ${CLANG_FORMAT} "--version" OUTPUT_VARIABLE clang_format_version_info)
|
||||
string(REGEX MATCH "version ([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" clang_format_version_info CLANG_FORMAT_VERSION)
|
||||
if(clang_format_version_info AND NOT CLANG_FORMAT_VERSION VERSION_LESS 10.0)
|
||||
# Enable 'make reformat' target.
|
||||
add_custom_target(reformat
|
||||
VERBATIM
|
||||
COMMAND
|
||||
git ls-files |
|
||||
grep -E \\.\(c|cxx|cc|cpp|h|hxx|hpp\)\(\\.in\)?\$ |
|
||||
xargs ${CLANG_FORMAT} -i --style=file
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT "${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
|
||||
|
@ -128,7 +128,7 @@ CXX ?= g++
|
||||
CXXSTD ?= $(shell $(CXX) -std=c++27 -c test/test.cc -o /dev/null 2>/dev/null && echo -std=c++17 || echo -std=c++11)
|
||||
CXXFLAGS := $(CXXSTD) $(filter-out -std=gnu11,$(CFLAGS))
|
||||
TAR ?= $(shell which gnu-tar || echo tar)
|
||||
CLANG_FORMAT ?= $(shell (which clang-format || which clang-format-8 || which clang-format-9 || which clang-format-10 || which clang-format-11 || which clang-format-12) 2>/dev/null)
|
||||
CLANG_FORMAT ?= $(shell (which clang-format-12 || which clang-format-11 || which clang-format-10 || which clang-format) 2>/dev/null)
|
||||
|
||||
reformat:
|
||||
@if [ -n "$(CLANG_FORMAT)" ]; then \
|
||||
|
Loading…
x
Reference in New Issue
Block a user