From: Jochen Sprickerhof Date: Sat, 1 Feb 2020 23:22:36 +0000 (+0100) Subject: Link against atomic if needed (found on armel) X-Git-Tag: archive/raspbian/1.12.1+dfsg-4+rpi1~1^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7ff9d773fc8aec8b90fe70b58d429c11c0f3da9e;p=pcl.git Link against atomic if needed (found on armel) Gbp-Pq: Name 0002-Link-against-atomic-if-needed-found-on-armel.patch --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e5aa7f40..7de7093b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,20 @@ elseif(MINGW) set(CMAKE_COMPILER_IS_MINGW 1) endif() +# https://github.com/fish-shell/fish-shell/issues/5865 +include(CheckCXXSourceCompiles) +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() + # 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) diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake index 88ce7f90..680b3ff3 100644 --- a/cmake/pcl_targets.cmake +++ b/cmake/pcl_targets.cmake @@ -229,7 +229,7 @@ function(PCL_ADD_LIBRARY _name) endif() if((UNIX AND NOT ANDROID) OR MINGW) - target_link_libraries(${_name} m) + target_link_libraries(${_name} m ${ATOMIC_LIBRARY}) endif() if(MINGW)