Skip to content

Commit

Permalink
build: use -pthread when possible
Browse files Browse the repository at this point in the history
Using -pthread is the "right way" of enabling threading support in GCC
and similar, and this can accomplished with the
THREADS_PREFER_PTHREAD_FLAG option. Its use is also recommended by the
CMake devs, see
https://cmake.org/cmake/help/latest/module/FindThreads.html#variable:THREADS_PREFER_PTHREAD_FLAG
  • Loading branch information
Tachi107 authored and athre0z committed Nov 13, 2021
1 parent 3de49d4 commit 8983325
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ zyan_set_source_group("Zycore")

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT ZYAN_NO_LIBC)
target_compile_definitions("Zycore" PRIVATE "_GNU_SOURCE")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries("Zycore" Threads::Threads)
endif ()
Expand Down

0 comments on commit 8983325

Please sign in to comment.