cmake-init icon indicating copy to clipboard operation
cmake-init copied to clipboard

clang-format options

Open friendlyanon opened this issue 4 years ago • 2 comments

f325e682c7849f3a29cdf0114e52b24af42e9921 introduced clang-format to the project, but instead of using one of the built-in styles, I rolled my own.

The goal of a format ruleset should be:

  • consistency
  • readability
  • diff friendliness
  • similarity to other languages (polyglot friendliness)

I hope what I created achieves that and if not, then feedback is welcome.

friendlyanon avatar Jun 04 '21 00:06 friendlyanon

But you should not format all files you be able to see:

/usr/local/bin/cmake -D FORMAT_COMMAND=clang-format -D "PATTERNS=*.json;*.cppm" -P /Users/clausklein/Workspace/cpp/fmt-module/cmake/lint.cmake
The following files are badly formatted:

.CMakeUserPresets.json
CMakePresets.json
CMakeUserPresets.json
build/compile_commands.json
build/dev/_CPack_Packages/Darwin/TGZ/fmt-11.0.2-Darwin/lib/cmake/fmt/module/fmt.cppm
build/dev/compile_commands.json
build/dev/src/tests/CMakeFiles/header-only-test.dir/CXXDependInfo.json
build/dev/src/tests/CMakeFiles/header-only-test.dir/CXXModules.json
build/dev/src/tests/find-package-test/CMakeFiles/fmt_module.dir/CXXDependInfo.json
build/dev/src/tests/find-package-test/CMakeFiles/fmt_module.dir/CXXModules.json
build/dev/src/tests/find-package-test/compile_commands.json
build/src/tests/CMakeFiles/header-only-test.dir/CXXDependInfo.json
build/src/tests/CMakeFiles/header-only-test.dir/CXXModules.json
build/tests/CMakeFiles/header-only-test.dir/CXXDependInfo.json
build/tests/CMakeFiles/header-only-test.dir/CXXModules.json
build/tests/compile_commands.json
module/fmt.cppm
stagedir/lib/cmake/fmt/module/fmt.cppm

CMake Error at cmake/lint.cmake:43 (message):
  Run again with FIX=YES to fix these files.


ninja: build stopped: subcommand failed.

git ls-files '::*.json' '::*.cppm' would be better to get the file list.

ClausKlein avatar Dec 04 '24 12:12 ClausKlein

bash-5.2$ git ls-files '::*.json' '::*.cppm' '::*.cc' '::*.hh'
.CMakeUserPresets.json
CMakePresets.json
module/fmt.cppm
src/tests/header-only-test.cc
bash-5.2$ 

ClausKlein avatar Dec 04 '24 12:12 ClausKlein