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.13.0+dfsg-3+rpi1^2^2^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d2f2fd6709f34216de1d9c1079e8872d480b38b1;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 1e61bfdb..02b690d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,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 ff79c207..f12a4723 100644 --- a/cmake/pcl_targets.cmake +++ b/cmake/pcl_targets.cmake @@ -230,7 +230,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) @@ -391,7 +391,7 @@ macro(PCL_ADD_TEST _name _exename) #target_link_libraries(${_exename} ${GTEST_BOTH_LIBRARIES} ${PCL_ADD_TEST_LINK_WITH}) target_link_libraries(${_exename} ${PCL_ADD_TEST_LINK_WITH} ${CLANG_LIBRARIES}) - target_link_libraries(${_exename} Threads::Threads) + target_link_libraries(${_exename} Threads::Threads ${ATOMIC_LIBRARY}) #Only applies to MSVC if(MSVC)