diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-22 11:05:28 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-22 11:05:28 +0800 |
| commit | 7a4ffacb0094bc9c19202dea26f5e246002d5509 (patch) | |
| tree | a46f5a30b9b01d826cb084a0ca1f5c33d0477fb7 | |
| parent | 45cb2b703a080b7b791781bdb76ff557753652a4 (diff) | |
cmake: fix clang-format and clang-tidy
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | Makefile | 7 |
2 files changed, 18 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 639fe3e..a493396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,9 +23,22 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(FTXUI REQUIRED IMPORTED_TARGET ftxui) file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "src/*.cpp") +file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS "src/*.hpp" "include/*.hpp") add_executable(${PROJECT_NAME} ${SOURCES}) +add_custom_target( + clang-format + COMMAND clang-format -i ${SOURCES} ${HEADERS} + COMMENT "clang-format" + VERBATIM) + +add_custom_target( + clang-tidy + COMMAND clang-tidy -fix-errors ${SOURCES} -- ${CMAKE_CXX_FLAGS} + COMMENT "clang-tidy" + VERBATIM) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_26) add_compile_options(-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion @@ -24,7 +24,10 @@ install: uninstall: xargs rm < ./build/install_manifest.txt -format: - find src -name "*.cpp" -o -name "*.hpp" | xargs clang-format -i +clang-format: + cmake --build ./build --target clang-format + +clang-tidy: + cmake --build ./build --target clang-tidy .PHONY: stub release debug clean all install uninstall format |
