Skip to content

Commit cffd623

Browse files
committed
fix: Do not compile benchmark own tests
1 parent 6318e8f commit cffd623

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

tests/benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if (NOT benchmark_FOUND)
1212
GIT_REPOSITORY https://github.com/google/benchmark.git
1313
GIT_TAG v${BENCHMARK_VERSION}
1414
)
15+
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
1516
FetchContent_MakeAvailable(benchmark)
1617
else ()
1718
MESSAGE(FATAL_ERROR "Google::benchmark ${BENCHMARK_VERSION} not found")

tests/unit/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ if (NOT GTest_FOUND)
2020
endif ()
2121
endif ()
2222

23-
file(GLOB_RECURSE UNIT_TESTS_FILES LIST_DIRECTORIES false ${CMAKE_SOURCE_DIR}/tests/unit/*.cpp)
23+
file(GLOB_RECURSE UNIT_TESTS_FILES LIST_DIRECTORIES false
24+
${CMAKE_SOURCE_DIR}/tests/unit/*.cpp
25+
)
2426
add_executable(${PROJECT_NAME} ${UNIT_TESTS_FILES})
2527

26-
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tests/lib)
28+
target_include_directories(${PROJECT_NAME} PUBLIC
29+
${CMAKE_SOURCE_DIR}
30+
${CMAKE_SOURCE_DIR}/tests/lib
31+
)
2732
target_link_libraries(${PROJECT_NAME} ${PROJECT_EULER_LIBRARY})
2833
if (GTest_FOUND)
2934
target_link_libraries(${PROJECT_NAME} GTest::Main)

0 commit comments

Comments
 (0)