Description: Add -latomic where needed This is to fix the build on armel and mipsel Author: Mattia Rizzolo Forwarded: https://gitlab.com/inkscape/inkscape/-/merge_requests/1867 Last-Update: 2020-05-07 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -60,6 +60,22 @@ list(APPEND INKSCAPE_LIBS "-latomic") ENDIF() +include(CheckCXXSourceCompiles) +CHECK_CXX_SOURCE_COMPILES(" +#include +#include +std::atomic x (0); +int main() { + uint64_t i = x.load(std::memory_order_relaxed); + return 0; +} +" +LIBATOMIC_NOT_NEEDED) +IF (NOT LIBATOMIC_NOT_NEEDED) + message(STATUS " Adding -latomic to the libs.") + list(APPEND INKSCAPE_LIBS "-latomic") +ENDIF() + # ---------------------------------------------------------------------------- # Helper macros