Skip to content

Commit 25258cc

Browse files
committed
Fix CI build
1 parent 3f3a699 commit 25258cc

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

tests/CMakeLists.txt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@ if (GTest_FOUND)
66
else()
77
include(FetchContent)
88
FetchContent_Declare(
9-
googletest
10-
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
9+
googletest
10+
GIT_REPOSITORY https://github.com/google/googletest.git
11+
GIT_TAG v1.17.0
1112
)
12-
# For Windows: Prevent overriding the parent project's compiler/linker on Windows
13-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
13+
if (WIN32)
14+
# For Windows: Prevent overriding the parent project's compiler/linker on Windows
15+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
16+
endif()
1417
FetchContent_MakeAvailable(googletest)
1518
endif()
1619

1720
enable_testing()
1821

22+
include(GoogleTest)
23+
1924
add_executable(websocket_tests websocket_tests.cpp)
2025
target_link_libraries(websocket_tests PRIVATE slick_net GTest::gtest_main)
2126

@@ -27,5 +32,15 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
2732
target_compile_options(http_tests PRIVATE /fsanitize=address)
2833
endif()
2934

30-
add_test(NAME WebsocketTests COMMAND websocket_tests)
31-
add_test(NAME HttpTests COMMAND http_tests)
35+
# Discover tests with increased timeout
36+
gtest_discover_tests(websocket_tests DISCOVERY_TIMEOUT 30)
37+
gtest_discover_tests(http_tests DISCOVERY_TIMEOUT 30)
38+
39+
# Set test properties
40+
set_target_properties(websocket_tests PROPERTIES
41+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
42+
)
43+
44+
set_target_properties(http_tests PROPERTIES
45+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
46+
)

0 commit comments

Comments
 (0)