Skip to content

Commit

Permalink
Fix CI: Link to Pthread library explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonMatthesKDAB committed Jan 10, 2024
1 parent 691c74b commit 1304f46
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/signal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ project(test-signal VERSION 0.1 LANGUAGES CXX)
add_executable(${PROJECT_NAME}
tst_signal.cpp
)
target_link_libraries(${PROJECT_NAME} KDAB::KDBindings)
# For some reason, CMake with gcc doesn't automatically include the pthread library
# when using std::thread. This is a workaround for that.
# IMHO, this is ridiculous, std::thread is part of the standard library, it should just work
# when I use C++, but it is what it is.
# See: https://cmake.cmake.narkive.com/wWDhK9RQ/undefined-reference-to-pthread-create
find_package (Threads)
target_link_libraries(${PROJECT_NAME} KDAB::KDBindings ${CMAKE_THREAD_LIBS_INIT})

add_test(${PROJECT_NAME} ${PROJECT_NAME})

0 comments on commit 1304f46

Please sign in to comment.