Link against libatomic if required

On some architectures it is required to explicitely link against
libatomic to use e.g. 8 byte atomics.
Check during configuration if it compiles without libatomic. If not,
add it to target_link_libraries.

Noticed on Debian build servers: https://bugs.debian.org/934799
This commit is contained in:
Reiner Herrmann 2019-09-15 18:23:30 +02:00
parent 4895cd27a4
commit 63b23d9e65

View File

@ -513,6 +513,21 @@ else()
target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
endif()
# check if linking against libatomic is required
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
int main() {
std::atomic<uint64_t> x{0};
x.load();
return 0;
}
" NO_LIBATOMIC_NEEDED)
if (NOT NO_LIBATOMIC_NEEDED)
target_link_libraries(supertuxkart atomic)
endif()
# CURL and OpenSSL or Nettle
# 1.0.1d for compatible AES GCM handling
SET(OPENSSL_MINIMUM_VERSION "1.0.1d")