set(CMAKE_COMPILER_IS_MINGW 1)
endif()
+# https://github.com/fish-shell/fish-shell/issues/5865
+include(CheckCXXSourceCompiles)
+CHECK_CXX_SOURCE_COMPILES("
+#include <atomic>
+struct big { int foo[64]; };
+std::atomic<big> x;
+int main() {
+ return x.load().foo[13];
+}"
+LIBATOMIC_NOT_NEEDED)
+IF (NOT LIBATOMIC_NOT_NEEDED)
+ SET(ATOMIC_LIBRARY "atomic")
+ENDIF()
+
# Create a variable with expected default CXX flags
# This will be used further down the road to check if the user explicitly provided CXX flags
if(CMAKE_COMPILER_IS_MSVC)
endif()
if((UNIX AND NOT ANDROID) OR MINGW)
- target_link_libraries(${_name} m)
+ target_link_libraries(${_name} m ${ATOMIC_LIBRARY})
endif()
if(MINGW)
#target_link_libraries(${_exename} ${GTEST_BOTH_LIBRARIES} ${PCL_ADD_TEST_LINK_WITH})
target_link_libraries(${_exename} ${PCL_ADD_TEST_LINK_WITH} ${CLANG_LIBRARIES})
- target_link_libraries(${_exename} Threads::Threads)
+ target_link_libraries(${_exename} Threads::Threads ${ATOMIC_LIBRARY})
#Only applies to MSVC
if(MSVC)