--- CMakeLists.txt +++ CMakeLists.txt @@ -161,6 +161,12 @@ if (enable_threads) message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") if (without_libatomic_ops OR BORLAND OR MSVC OR WATCOM) include_directories(libatomic_ops/src) + find_package(Atomic_ops CONFIG) + if (Atomic_ops_FOUND) + get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(${AO_INCLUDE_DIRS}) + endif() # Note: alternatively, use CFLAGS_EXTRA to pass -I<...>/libatomic_ops/src. else() # Assume the compiler supports GCC atomic intrinsics.