File tree Expand file tree Collapse file tree 3 files changed +1401
-35
lines changed Expand file tree Collapse file tree 3 files changed +1401
-35
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,18 @@ project(${PROJECT_N} VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
1010# Generate compile_commands.json for clang-based tooling (clangd / clang-tidy)
1111set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
1212
13+ include (cmake/CPM.cmake)
14+
15+ CPMAddPackage(
16+ NAME "googletest"
17+ GITHUB_REPOSITORY "google/googletest"
18+ GIT_TAG "v1.17.0"
19+ GIT_SHALLOW TRUE
20+ OPTIONS "GTEST_BUILD_TESTS OFF"
21+ OPTIONS "GTEST_BUILD_EXAMPLES OFF"
22+ OPTIONS "GTEST_BUILD_DOCS OFF"
23+ )
24+
1325# Ensure clang tooling can pick up compile_commands.json from project root
1426if (CMAKE_EXPORT_COMPILE_COMMANDS)
1527 add_custom_target (copy-compile-commands ALL
@@ -67,7 +79,7 @@ set_target_properties(${PROJECT_N} PROPERTIES
6779target_include_directories (${PROJECT_N} PUBLIC ${PROJECT_SOURCE_DIR} /src)
6880
6981add_executable (serial_tests tests/serial_test.cpp)
70- target_link_libraries (serial_tests PRIVATE ${PROJECT_N} )
82+ target_link_libraries (serial_tests PRIVATE ${PROJECT_N} gtest_main )
7183
7284target_include_directories (serial_tests PRIVATE ${PROJECT_SOURCE_DIR} /src)
7385
You can’t perform that action at this time.
0 commit comments