rticommunity / rticonnextdds-examples

This repository includes examples on how to use specific features of RTI Connext DDS.
Other
125 stars 136 forks source link

Include flags depending on the ConnextDDS version #385

Open lulivi opened 3 years ago

lulivi commented 3 years ago

Information

What is the current behavior?

There are some examples (listed below) that add flags already included by FindRTIConnextDDS

File list

10 results - 10 files

examples/connext_dds/dynamic_data_access_union_discriminator/c/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_access_union_discriminator/c++/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_access_union_discriminator/c++03/CMakeLists.txt:
  38          PROPERTIES
  39:             LINK_FLAGS -Wl,--no-as-needed)
  40  endif()

examples/connext_dds/dynamic_data_access_union_discriminator/c++11/CMakeLists.txt:
  38          PROPERTIES
  39:             LINK_FLAGS -Wl,--no-as-needed)
  40  endif()

examples/connext_dds/dynamic_data_nested_structs/c/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_nested_structs/c++/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_nested_structs/c++03/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_sequences/c/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_sequences/c++/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

examples/connext_dds/dynamic_data_sequences/c++03/CMakeLists.txt:
  43          PROPERTIES
  44:             LINK_FLAGS -Wl,--no-as-needed)
  45  endif()

Suggested solutions

As the distributed logger component is included in the top-level CMakeLists.txt, we need to check whether the version is greater than 6.1.0, to filter them out. See comment

iblancasa commented 3 years ago

The problem is that it will not be possible to build those examples as standalone. The -Wl,--no-as-needed are added because we are enabling the distributed_logger component at the top level CMakeLists.txt. So, it is not a good idea to remove them (probably, since those flags are not needed from 6.1.0, we can add or not them depending on the ConnextDDS version)