From 619cdbb7ac9819ed58d544fa1498329b428bbdd8 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Wed, 14 Feb 2024 19:27:12 +0100 Subject: [PATCH] [UR] Add missing Threads library to common Before https://github.com/oneapi-src/unified-runtime/pull/1216 adapters linked with disjoint_pool library that linked with Threads library. PR #1216 replace disjoint_pool with a version from UMF library that does not link with Threads lib explicitly which leads to compilation error on xmain. Fix this by explicitly adding adding Threads to ur_common. --- source/common/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index 0cac2afb0a..f787fc6c0b 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -47,3 +47,10 @@ target_link_libraries(ur_common PUBLIC ${CMAKE_DL_LIBS} ${PROJECT_NAME}::headers ) + +if (UNIX) + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package(Threads REQUIRED) + target_link_libraries(ur_common PUBLIC Threads::Threads) +endif()