Skip to content

Commit 11e974f

Browse files
committed
core: target cmake updated for .clang-tidy
1 parent d1d59dd commit 11e974f

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
77

88

9-
# .clang-tidy settp
9+
# .clang-tidy setup
1010
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
1111
if(CLANG_TIDY_EXE)
1212
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")

test/0001_Basics/CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,19 @@ FetchContent_MakeAvailable(googletest)
1313
enable_testing()
1414

1515
add_executable(
16-
0001-Basics-Tests
16+
0001BasicsTests
1717
NodeTest.cc)
1818

1919
target_link_libraries(
20-
0001-Basics-Tests
20+
0001BasicsTests
2121
GTest::gtest_main
22-
)
23-
24-
target_link_libraries(
25-
0001-Basics-Tests
2622
0001BASICS
2723
)
2824

25+
# Add .clang-tidy configuration to this library.
2926
if(CLANG_TIDY_EXE)
3027
set_target_properties(0001BASICS PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
3128
endif()
3229

3330
include(GoogleTest)
34-
gtest_discover_tests(0001-Basics-Tests DISCOVERY_TIMEOUT 30)
31+
gtest_discover_tests(0001BasicsTests DISCOVERY_TIMEOUT 30)

test/0002_Tree/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@ FetchContent_Declare(
55
googletest
66
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
77
)
8+
89
# For Windows: Prevent overriding the parent project's compiler/linker settings
910
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
1011
FetchContent_MakeAvailable(googletest)
1112

12-
1313
enable_testing()
1414

1515
add_executable(
1616
0002TreeTests
17-
0001_BinarySearchTreeTest.cc)
17+
0001_BinarySearchTreeTest.cc
18+
)
1819

1920
target_link_libraries(
2021
0002TreeTests
2122
GTest::gtest_main
2223
0002TREE
2324
)
2425

26+
# Add .clang-tidy configuration to this library.
27+
if(CLANG_TIDY_EXE)
28+
set_target_properties(0002TREE PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
29+
endif()
30+
2531
include(GoogleTest)
2632
gtest_discover_tests(0002TreeTests DISCOVERY_TIMEOUT 30)

test/0003_Graph/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ FetchContent_Declare(
55
googletest
66
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
77
)
8+
89
# For Windows: Prevent overriding the parent project's compiler/linker settings
910
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
1011
FetchContent_MakeAvailable(googletest)
1112

12-
1313
enable_testing()
1414

1515
add_executable(
@@ -41,5 +41,10 @@ target_link_libraries(
4141
0003GRAPH
4242
)
4343

44+
# Add .clang-tidy configuration to this library.
45+
if(CLANG_TIDY_EXE)
46+
set_target_properties(0003GRAPH PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
47+
endif()
48+
4449
include(GoogleTest)
4550
gtest_discover_tests(0003GraphTests DISCOVERY_TIMEOUT 30)

0 commit comments

Comments
 (0)