Skip to content

Commit b707ddf

Browse files
committed
build(error): add option that enable source code formatting check
1 parent d58962d commit b707ddf

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
cmake ${{ matrix.package }} \
2323
-B ${{ matrix.package }}/build \
2424
-D BUILD_TESTING=ON
25+
-D CHECK_FORMAT=ON
2526
2627
- name: Build project
2728
run: cmake --build ${{ matrix.package }}/build
@@ -50,9 +51,6 @@ jobs:
5051
- name: Checkout repository
5152
uses: actions/[email protected]
5253

53-
- name: Install cmake-format
54-
run: pip3 install cmake-format
55-
5654
- name: Configure CMake
5755
run: |
5856
cmake ${{ matrix.package }} `
@@ -75,10 +73,6 @@ jobs:
7573
- name: Checkout repository
7674
uses: actions/[email protected]
7775

78-
# TODO: remove this later
79-
- name: Install cmake-format
80-
run: pip3 install cmake-format
81-
8276
- name: Configure and build project
8377
uses: threeal/[email protected]
8478
with:
@@ -94,10 +88,6 @@ jobs:
9488
- name: Checkout repository
9589
uses: actions/[email protected]
9690

97-
# TODO: remove this later
98-
- name: Install cmake-format
99-
run: pip3 install cmake-format
100-
10191
- name: Configure and build project
10292
uses: threeal/[email protected]
10393
with:

error/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ target_link_libraries(error PUBLIC fmt)
1313

1414
# Check if this project is the main project
1515
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
16+
option(CHECK_FORMAT "Enable source code formatting check" OFF)
17+
1618
# Import Format.cmake to format source code
17-
cpmaddpackage("gh:TheLartians/[email protected]")
18-
add_dependencies(error fix-format)
19+
if(CHECK_FORMAT)
20+
cpmaddpackage("gh:TheLartians/[email protected]")
21+
add_dependencies(error fix-format)
22+
endif()
1923

2024
if(BUILD_TESTING)
2125
enable_testing()

0 commit comments

Comments
 (0)