Skip to content

Commit e089304

Browse files
committed
add cmake-format
1 parent 75f56b3 commit e089304

File tree

3 files changed

+72
-15
lines changed

3 files changed

+72
-15
lines changed

.cmake-format

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# notes for additional commands
2+
#
3+
# nargs: '*' to allow multiple arguments
4+
# kwargs: &fookwargs to definite keyword arguments
5+
# kwargs: *fookwargs to use the same keyword arguments as fookwargs
6+
# NAME: 1 to allow single keyword arguments
7+
# NAME: + to allow multiple keyword arguments
8+
# NAME: * to allow multiple keyword arguments
9+
# spelling: FOO to use foo to FOO spelling
10+
11+
parse:
12+
additional_commands:
13+
FetchContent_Declare:
14+
pargs:
15+
nargs: '*'
16+
flags: []
17+
kwargs:
18+
GIT_TAG: 1
19+
GITHUB_REPOSITORY: 1
20+
GITLAB_REPOSITORY: 1
21+
GIT_REPOSITORY: 1
22+
SVN_REPOSITORY: 1
23+
SVN_REVISION: 1
24+
URL: 1
25+
URL_HASH: 1
26+
URL_MD5: 1
27+
FIND_PACKAGE_ARGS: +
28+
FetchContent_MakeAvailable:
29+
pargs:
30+
nargs: '*'
31+
flags: []
32+
execute_process:
33+
pargs:
34+
nargs: '*'
35+
flags: []
36+
kwargs:
37+
COMMAND: +
38+
WORKING_DIRECTORY: 1
39+
set_target_properties:
40+
pargs:
41+
nargs: '*'
42+
flags: []
43+
kwargs:
44+
PROPERTIES: +
45+
IMPORTED_LOCATION: 1
46+
INTERFACE_INCLUDE_DIRECTORIES: 1
47+
format:
48+
tab_size: 2
49+
line_width: 120
50+
autosort: true
51+
dangle_parens: true
52+
max_subgroups_hwrap: 2
53+
max_pargs_hwrap: 3

.github/workflows/lint.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ jobs:
1414
fail-fast: false
1515

1616
steps:
17-
- name: Checkout Trantor source code
18-
uses: actions/checkout@v2
19-
with:
20-
submodules: true
21-
fetch-depth: 0
17+
- name: Checkout Trantor source code
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
fetch-depth: 0
2222

23-
- name: (Linux) Install dependencies
24-
run: |
25-
# Installing packages might fail as the github image becomes outdated
26-
sudo apt update
27-
sudo apt install dos2unix clang-format
23+
- name: (Linux) Install dependencies
24+
run: |
25+
# Installing packages might fail as the github image becomes outdated
26+
sudo apt update
27+
sudo apt install dos2unix clang-format
28+
pip install cmake-format
2829
29-
- name: Lint
30-
if: matrix.os == 'ubuntu-20.04'
31-
working-directory: ${{env.GITHUB_WORKSPACE}}
32-
shell: bash
33-
run: ./format.sh && git diff --exit-code
30+
- name: Lint
31+
run: ./format.sh && git diff --exit-code

format.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ clang-format --version
44

55
find trantor -name *.h -o -name *.cc -exec dos2unix {} \;
66
find trantor -name *.h -o -name *.cc|xargs clang-format -i -style=file
7+
8+
cmake-format --version
9+
find . -maxdepth 1 -name CMakeLists.txt|xargs cmake-format -i
10+
find trantor -name CMakeLists.txt|xargs cmake-format -i
11+
find cmake -name *.cmake -o -name *.cmake.in|xargs cmake-format -i
12+
find cmake_modules -name *.cmake -o -name *.cmake.in|xargs cmake-format -i

0 commit comments

Comments
 (0)