diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2021-04-05 13:19:19 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2021-04-05 13:19:19 +0200 |
commit | 661b635de6d65c27b57be22ecc0e3feacc45401e (patch) | |
tree | a57616bf23c8a2d5da89667d000c85818e2cec31 /CMakeLists.txt | |
parent | 0f1d99f75f7247d214b53173c66c9b8d24fcae74 (diff) | |
download | ccache-661b635de6d65c27b57be22ecc0e3feacc45401e.tar.gz |
Use Clang-Format executable from muttleyxd/clang-tools-static-binaries
misc/format-files now executes misc/clang-format, which works like this:
1. If environment variable CLANG_FORMAT is set, execute $CLANG_FORMAT.
2. Otherwise, if <ccache-top-dir>/misc/.clang-format-exe exists, execute
that program.
3. Otherwise, download a statically linked clang-format executable,
verify its integrity, place it in
<ccache-top-dir>/misc/.clang-format-exe and execute it.
This makes it possible for us to lock Clang-Format to version 10 and
remove most “// clang-format off/on” comments.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fc2ff665..0825f2af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,26 +176,16 @@ endif() # # Special formatting targets # -find_program( - CLANG_FORMAT_EXE - NAMES "clang-format" - DOC "Path to clang-format executable.") -mark_as_advanced(CLANG_FORMAT_EXE) # Don't show in CMake UIs - -if(NOT CLANG_FORMAT_EXE) - message(STATUS "clang-format not found") -else() - add_custom_target( - format - COMMAND misc/format-files --all - COMMENT "Formatting code" - USES_TERMINAL - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - - add_custom_target( - check_format - COMMAND misc/format-files --all --check - COMMENT "Checking code formatting" - USES_TERMINAL - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -endif() +add_custom_target( + format + COMMAND misc/format-files --all + COMMENT "Formatting code" + USES_TERMINAL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + +add_custom_target( + check_format + COMMAND misc/format-files --all --check + COMMENT "Checking code formatting" + USES_TERMINAL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) |