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>
This commit is contained in:
mergify[bot] 2021-08-30 13:58:51 -03:00 committed by GitHub
parent c843299592
commit 1a9d4f3b92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,6 +71,17 @@ target_include_directories(rmw_cyclonedds_cpp PUBLIC
target_link_libraries(rmw_cyclonedds_cpp target_link_libraries(rmw_cyclonedds_cpp
CycloneDDS::ddsc 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 ament_target_dependencies(rmw_cyclonedds_cpp
"rcutils" "rcutils"