diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af33fab..dedee52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,7 @@ jobs: cmake ${{ matrix.package }} \ -B ${{ matrix.package }}/build \ -D BUILD_TESTING=ON + -D CHECK_FORMAT=ON - name: Build project run: cmake --build ${{ matrix.package }}/build @@ -50,9 +51,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.5.3 - - name: Install cmake-format - run: pip3 install cmake-format - - name: Configure CMake run: | cmake ${{ matrix.package }} ` @@ -75,10 +73,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.5.3 - # TODO: remove this later - - name: Install cmake-format - run: pip3 install cmake-format - - name: Configure and build project uses: threeal/cmake-action@v1.1.0 with: @@ -94,10 +88,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.5.3 - # TODO: remove this later - - name: Install cmake-format - run: pip3 install cmake-format - - name: Configure and build project uses: threeal/cmake-action@v1.1.0 with: diff --git a/error/CMakeLists.txt b/error/CMakeLists.txt index 5da870f..ba2616d 100644 --- a/error/CMakeLists.txt +++ b/error/CMakeLists.txt @@ -13,9 +13,13 @@ target_link_libraries(error PUBLIC fmt) # Check if this project is the main project if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + option(CHECK_FORMAT "Enable source code formatting check" OFF) + # Import Format.cmake to format source code - cpmaddpackage("gh:TheLartians/Format.cmake@1.7.3") - add_dependencies(error fix-format) + if(CHECK_FORMAT) + cpmaddpackage("gh:TheLartians/Format.cmake@1.7.3") + add_dependencies(error fix-format) + endif() if(BUILD_TESTING) enable_testing()