diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e0fdc7c1a3f..082158c6ee57 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -314,6 +314,13 @@ else() endif() endif() +# On clang and gcc, some functionalities of std::atomic require -latomic. +# See . +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(PLATFORM_LIBS ${PLATFORM_LIBS} atomic) +endif() + check_include_files(endian.h HAVE_ENDIAN_H) configure_file(