Skip to content

Commit

Permalink
Minor revamp of the CMakeLists.txt. (#468)
Browse files Browse the repository at this point in the history
The most important bit in here is to set
CMAKE_CXX_STANDARD_REQUIRED to ON, so it builds in C++17
mode with clang.  Besides that, cleanup a comment, and
get rid of extra calls to target_link_libraries that
aren't required (we can just combine that all into one
call).

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
  • Loading branch information
clalancette committed Sep 12, 2023
1 parent 932540a commit 0c59f03
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions rmw_cyclonedds_cpp/CMakeLists.txt
Expand Up @@ -16,9 +16,10 @@ cmake_minimum_required(VERSION 3.5)

project(rmw_cyclonedds_cpp)

# Default to C++14
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand All @@ -31,7 +32,6 @@ find_package(rcutils REQUIRED)
find_package(rcpputils REQUIRED)
find_package(tracetools REQUIRED)

#find_package(cyclonedds_cmake_module REQUIRED)
find_package(CycloneDDS QUIET CONFIG)
if(CycloneDDS_FOUND)
# Support for shared memory in RMW depends on support for shared memory being compiled in
Expand Down Expand Up @@ -80,23 +80,23 @@ add_library(rmw_cyclonedds_cpp
src/TypeSupport2.cpp
src/TypeSupport.cpp)

target_link_libraries(rmw_cyclonedds_cpp PRIVATE
CycloneDDS::ddsc)

if(_cyclonedds_has_shm)
target_link_libraries(rmw_cyclonedds_cpp PRIVATE iceoryx_binding_c::iceoryx_binding_c)
endif()

target_link_libraries(rmw_cyclonedds_cpp PUBLIC
rmw::rmw)

target_link_libraries(rmw_cyclonedds_cpp PRIVATE
CycloneDDS::ddsc
rcutils::rcutils
rcpputils::rcpputils
rmw_dds_common::rmw_dds_common_library
rosidl_typesupport_introspection_c::rosidl_typesupport_introspection_c
rosidl_typesupport_introspection_cpp::rosidl_typesupport_introspection_cpp
rmw_dds_common::rmw_dds_common_library
rosidl_runtime_c::rosidl_runtime_c
tracetools::tracetools)
tracetools::tracetools
)

if(_cyclonedds_has_shm)
target_link_libraries(rmw_cyclonedds_cpp PRIVATE iceoryx_binding_c::iceoryx_binding_c)
endif()

if(CMAKE_GENERATOR_PLATFORM)
set(TARGET_ARCH "${CMAKE_GENERATOR_PLATFORM}")
Expand Down

0 comments on commit 0c59f03

Please sign in to comment.