Skip to content

Commit

Permalink
Merge pull request #797 from hdelan/fix-call-once-bug
Browse files Browse the repository at this point in the history
[loader] Add use of threads so -lpthread works when building
  • Loading branch information
kbenzie authored Aug 16, 2023
2 parents 47b6386 + 5c7c60b commit 2970796
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ if (UNIX)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(ur_loader PRIVATE Threads::Threads)
# Older gcc versions need -pthread, not just -lpthread
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.1)
if(CMAKE_USE_PTHREADS_INIT)
target_link_libraries(ur_loader PRIVATE "-pthread")
endif()
endif()
endif()
endif()

if(WIN32)
Expand Down

0 comments on commit 2970796

Please sign in to comment.