From 1a9d4f3b922089be5e79c40aad31f6d4edc736f2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:58:51 -0300 Subject: [PATCH] rmw_cyclonedds_cpp/CMakeLists.txt: add -latomic for RISC-V (#332) (#333) (cherry picked from commit 91646cedfc368e29ab7e8f70cbf77aa1e354b5c4) Co-authored-by: guillaume-pais-siemens <79512275+guillaume-pais-siemens@users.noreply.github.com> --- rmw_cyclonedds_cpp/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rmw_cyclonedds_cpp/CMakeLists.txt b/rmw_cyclonedds_cpp/CMakeLists.txt index 480f1ac..4111a73 100644 --- a/rmw_cyclonedds_cpp/CMakeLists.txt +++ b/rmw_cyclonedds_cpp/CMakeLists.txt @@ -71,6 +71,17 @@ target_include_directories(rmw_cyclonedds_cpp PUBLIC target_link_libraries(rmw_cyclonedds_cpp CycloneDDS::ddsc ) +if(CMAKE_GENERATOR_PLATFORM) + set(TARGET_ARCH "${CMAKE_GENERATOR_PLATFORM}") +else() + set(TARGET_ARCH "${CMAKE_SYSTEM_PROCESSOR}") +endif() + +if(CMAKE_COMPILER_IS_GNUCXX AND TARGET_ARCH MATCHES "^(riscv|RISCV)64$") + # using GCC, libatomic is not automatically linked for RISC-V + target_link_libraries(rmw_cyclonedds_cpp -latomic) +endif() + ament_target_dependencies(rmw_cyclonedds_cpp "rcutils"