--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -480,6 +480,23 @@ list( APPEND CMAKE_REQUIRED_LIBRARIES -latomic ) endif() +check_cxx_source_compiles(" +#include +#include +int main() { + std::atomic x(0); + return static_cast(x.load()); +} +" HAVE_CXX_ATOMICS64_WITHOUT_LIB) + +if( NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) + if( HAVE_LIBATOMIC ) + link_libraries( atomic ) + else() + message( FATAL_ERROR "Audacity require libatomic for this architecture!" ) + endif() +endif() + # Add the dynamic linker library (if needed) to the list of required libraries list( APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS} )