mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 13:23:53 +08:00
cmake: add -latomic on platforms that need it for 64-bit atomic operations
Closes #5865.
This commit is contained in:
parent
3274dbacf4
commit
780bac671f
|
@ -172,7 +172,7 @@ ADD_LIBRARY(fishlib STATIC ${FISH_SRCS})
|
||||||
TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS})
|
TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS})
|
||||||
TARGET_LINK_LIBRARIES(fishlib
|
TARGET_LINK_LIBRARIES(fishlib
|
||||||
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
|
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
|
||||||
${PCRE2_LIB} ${Intl_LIBRARIES})
|
${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY})
|
||||||
|
|
||||||
# Define fish.
|
# Define fish.
|
||||||
ADD_EXECUTABLE(fish src/fish.cpp)
|
ADD_EXECUTABLE(fish src/fish.cpp)
|
||||||
|
|
|
@ -187,3 +187,16 @@ int main () {
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PROGRAM(SED sed)
|
FIND_PROGRAM(SED sed)
|
||||||
|
|
||||||
|
# https://github.com/fish-shell/fish-shell/issues/5865
|
||||||
|
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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user