Skip to content

Commit

Permalink
CMakeLists.txt: fix linking against static gtest
Browse files Browse the repository at this point in the history
We have to link libpthread manually in case the system-provided gtest library is static.
  • Loading branch information
magiblot committed Oct 1, 2023
1 parent 4df1e3c commit 68f680c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ if (TV_BUILD_TESTS)
${GTEST_MAIN}
)

if (NOT WIN32)
find_library(PTHREAD pthread REQUIRED)
tv_message(STATUS "Found 'pthread': ${PTHREAD}")
target_link_libraries(${PROJECT_NAME}-test PRIVATE
${PTHREAD}
)
endif()

add_custom_command(
OUTPUT ${PROJECT_NAME}-test-passed
COMMAND ${PROJECT_NAME}-test
Expand Down

0 comments on commit 68f680c

Please sign in to comment.