link with libatomic automatically if found
@@ -218,11 +218,11 @@ else()
if(MI_LIBRT)
list(APPEND mi_libraries ${MI_LIBRT})
endif()
-endif()
-
-if (MI_USE_LIBATOMIC)
+ find_library(MI_LIBATOMIC atomic)
+ if (MI_LIBATOMIC OR MI_USE_LIBATOMIC)
list(APPEND mi_libraries atomic)
endif()
+endif()
# -----------------------------------------------------------------------------
# Install and output names
