Fix linking of tst_qtcpsocket on Linux

The direct use of pthread_yield() requires pthread linkage, which --
according to the cmake docs -- is best done by using CMake's
Threads::Threads target and the -pthread compiler flag preference.

Change-Id: Iacbd7dfce3ee2f792cea7f58d52b6b8ba8a84b18
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Simon Hausmann 2019-08-09 12:57:50 +02:00
parent 73ba2ba2de
commit aaec072623

View File

@ -26,6 +26,12 @@ extend_target(tst_qtcpsocket CONDITION WIN32
ws2_32
)
# special case begin
set(THREADS_PREFER_PTHREAD_FLAG 1)
find_package(Threads)
target_link_libraries(tst_qtcpsocket PRIVATE Threads::Threads)
# special case end
#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
# DESTDIR = "../debug"