Skip to content

Commit 06bd626

Browse files
committed
Refs #23701. Only build Pro examples when using Fast DDS Pro.
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent 7969312 commit 06bd626

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ endif()
4646
find_package(fastdds REQUIRED)
4747
get_target_property(FAST_INCLUDE_DIR fastdds INTERFACE_INCLUDE_DIRECTORIES)
4848

49+
# Default tweak to 0 in case the version is only X.Y or X.Y.Z
50+
set(_fastdds_pro FALSE)
51+
52+
# If the version has a 4th component, capture it
53+
if(DEFINED fastdds_VERSION AND
54+
fastdds_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.(\\d+)$")
55+
# CMAKE_MATCH_4 is the tweak component
56+
set(_fastdds_tweak "${CMAKE_MATCH_4}")
57+
if(_fastdds_tweak GREATER 0)
58+
set(_fastdds_pro TRUE)
59+
endif()
60+
endif()
61+
62+
message(STATUS "Found Fast DDS ${fastdds_VERSION} (tweak: ${_fastdds_tweak})")
4963
message(STATUS "Fast DDS include directories: ${FAST_INCLUDE_DIR}")
5064
file(GLOB_RECURSE HPP_FILES "${FAST_INCLUDE_DIR}/fastdds/**/*.h*")
5165

code/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ endif()
4646
####################################################################################################
4747
add_subdirectory(Examples/C++/DDSHelloWorld)
4848
add_subdirectory(Examples/C++/RpcClientServerBasic)
49-
add_subdirectory(Examples/C++/RpcClientServerFeed)
49+
# Add Pro features only when Fast DDS Pro is being used
50+
if(_fastdds_pro)
51+
add_subdirectory(Examples/C++/RpcClientServerFeed)
52+
else()
53+
message(STATUS "Skipping RpcClientServerFeed example because Fast DDS Pro is not being used")
54+
endif()
5055

5156
####################################################################################################
5257
# Compile test applications

0 commit comments

Comments
 (0)