Skip to content

Commit 2970796

Browse files
authored
Merge pull request #797 from hdelan/fix-call-once-bug
[loader] Add use of threads so -lpthread works when building
2 parents 47b6386 + 5c7c60b commit 2970796

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/loader/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ if (UNIX)
4848
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
4949
find_package(Threads REQUIRED)
5050
target_link_libraries(ur_loader PRIVATE Threads::Threads)
51+
# Older gcc versions need -pthread, not just -lpthread
52+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
53+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.1)
54+
if(CMAKE_USE_PTHREADS_INIT)
55+
target_link_libraries(ur_loader PRIVATE "-pthread")
56+
endif()
57+
endif()
58+
endif()
5159
endif()
5260

5361
if(WIN32)

0 commit comments

Comments
 (0)