File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -252,10 +252,17 @@ if (RT_LIBRARY)
252252 target_link_libraries (bson_shared PRIVATE ${RT_LIBRARY} )
253253endif ()
254254
255- find_library (M_LIBRARY m)
256- if (M_LIBRARY)
257- target_link_libraries (bson_shared PRIVATE ${M_LIBRARY} )
258- set (BSON_LIBRARIES ${BSON_LIBRARIES} ${M_LIBRARY} )
255+ # On macOS Big Sur, libm resolves to the SDK's tbd file, like:
256+ # /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
257+ # Not all consumers can easily link to a tbd file (notably golang will reject a tbd suffix by default)
258+ # macOS includes libm as part of libSystem (along with libc).
259+ # It does not need to be explicitly linked.
260+ if (!APPLE )
261+ find_library (M_LIBRARY m)
262+ if (M_LIBRARY)
263+ target_link_libraries (bson_shared PRIVATE ${M_LIBRARY} )
264+ set (BSON_LIBRARIES ${BSON_LIBRARIES} ${M_LIBRARY} )
265+ endif ()
259266endif ()
260267
261268set (THREADS_PREFER_PTHREAD_FLAG 1)
You can’t perform that action at this time.
0 commit comments