Skip to content

Commit b4f04be

Browse files
feat: add cmake formatter to precommit hooks
1 parent de91ac0 commit b4f04be

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ repos:
1515
hooks:
1616
- id: clang-format
1717
files: \.(cpp|cc|cxx|h|hpp)$
18+
- repo: https://github.com/BlankSpruce/gersemi-pre-commit
19+
rev: 0.27.2
20+
hooks:
21+
- id: gersemi

core/test/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,20 @@ FetchContent_Declare(
66
)
77
FetchContent_MakeAvailable(googletest)
88

9-
add_executable(unit_tests
10-
uri.cpp
11-
codspeed.cpp
12-
walltime.cpp
13-
)
9+
add_executable(unit_tests uri.cpp codspeed.cpp walltime.cpp)
1410

1511
target_include_directories(unit_tests PRIVATE ${CMAKE_SOURCE_DIR}/src)
1612

17-
target_link_libraries(unit_tests
18-
PRIVATE
19-
codspeed
20-
GTest::gtest
21-
GTest::gtest_main
13+
target_link_libraries(
14+
unit_tests
15+
PRIVATE codspeed GTest::gtest GTest::gtest_main
2216
)
2317

2418
# Treat warnings as errors for tests to catch issues early
2519
if(MSVC)
26-
target_compile_options(unit_tests PRIVATE /W4 /WX)
20+
target_compile_options(unit_tests PRIVATE /W4 /WX)
2721
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
28-
target_compile_options(unit_tests PRIVATE -Wall -Wextra -Werror)
22+
target_compile_options(unit_tests PRIVATE -Wall -Wextra -Werror)
2923
endif()
3024

3125
include(GoogleTest)

0 commit comments

Comments
 (0)