Index: lib/tsan/dd/CMakeLists.txt =================================================================== --- lib/tsan/dd/CMakeLists.txt +++ lib/tsan/dd/CMakeLists.txt @@ -22,6 +22,12 @@ dd_rtl.h ) +set(DD_LINKLIBS pthread) +# There is no libdl on FreeBSD. +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) + list(APPEND DD_LINKLIBS dl) +endif() + add_custom_target(dd) # Deadlock detector is currently supported on 64-bit Linux only. if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID) @@ -43,7 +49,7 @@ $ $ $) - target_link_libraries(clang_rt.dyndd-${arch} pthread dl) + target_link_libraries(clang_rt.dyndd-${arch} ${DD_LINKLIBS}) endif() add_dependencies(compiler-rt dd)