From 33a0f846503109b4c20a14b999472f79b7696018 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sat, 1 Jun 2024 21:37:40 +0700 Subject: [PATCH] build: utilize FixFormat.cmake --- .github/workflows/test.yml | 10 +++++++--- CMakeLists.txt | 10 ++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 635bd52..1082a35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,8 +30,12 @@ jobs: - name: Checkout this repository uses: actions/checkout@v4.1.6 - - name: Configure and check formatting + - name: Configure Project uses: threeal/cmake-action@v1.3.0 with: - run-build: true - build-args: --target format --target check-format + options: BUILD_TESTING=ON + + - name: Check Formatting + run: | + cmake --build build --target format-all + git diff --exit-code HEAD diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a21aa0..e0105f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,12 +23,6 @@ target_include_directories(result INTERFACE include) target_link_libraries(result INTERFACE error) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - cpmaddpackage( - GITHUB_REPOSITORY TheLartians/Format.cmake - VERSION 1.8.0 - OPTIONS "FORMAT_SKIP_CMAKE ON" - ) - if(BUILD_TESTING) enable_testing() @@ -44,4 +38,8 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) target_link_libraries(result_test PRIVATE result Catch2::Catch2WithMain) catch_discover_tests(result_test) endif() + + cpmaddpackage(gh:threeal/FixFormat.cmake@1.1.1) + include(${FixFormat_SOURCE_DIR}/cmake/FixFormat.cmake) + add_fix_format() endif()