diff --git a/cmake/DaemonFlags.cmake b/cmake/DaemonFlags.cmake index 0ddbd16761..70b84a66e7 100644 --- a/cmake/DaemonFlags.cmake +++ b/cmake/DaemonFlags.cmake @@ -304,10 +304,9 @@ else() endif() # The -pthread flag sets some preprocessor defines, - # it is also used to link with libpthread on Linux. - if (NOT APPLE) - try_c_cxx_flag(PTHREAD "-pthread") - endif() + # it is also used to link with libpthread. + try_c_cxx_flag(PTHREAD "-pthread") + try_linker_flag(LINKER_PTHREAD "-pthread") if (USE_ADDRESS_SANITIZER) set_cxx_flag("-fsanitize=address")