diff --git a/CMakeLists.txt b/CMakeLists.txt index 32cf3ac17..2f1560ecf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,7 @@ ADD_LIBRARY(fishlib STATIC ${FISH_SRCS}) TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS}) TARGET_LINK_LIBRARIES(fishlib ${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS} - ${PCRE2_LIB} ${Intl_LIBRARIES}) + ${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY}) # Define fish. ADD_EXECUTABLE(fish src/fish.cpp) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 3bc0f41c3..69dbb17b0 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -187,3 +187,16 @@ int main () { ) FIND_PROGRAM(SED sed) + +# https://github.com/fish-shell/fish-shell/issues/5865 +CHECK_CXX_SOURCE_COMPILES(" +#include +struct big { int foo[64]; }; +std::atomic x; +int main() { + return x.load().foo[13]; +}" +LIBATOMIC_NOT_NEEDED) +IF (NOT LIBATOMIC_NOT_NEEDED) + SET(ATOMIC_LIBRARY "atomic") +ENDIF()