Skip to content

Commit c9a1abd

Browse files
committed
Refs #21185: Copy xml file in the build folder
Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
1 parent 84125ad commit c9a1abd

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

examples/cpp/flow_control/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,19 @@ target_compile_definitions(flow_control PRIVATE
5050
target_link_libraries(flow_control fastdds fastcdr foonathan_memory)
5151
install(TARGETS flow_control
5252
RUNTIME DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/flow_control/${BIN_INSTALL_DIR})
53+
54+
55+
# Copy the XML files over to the build directory
56+
file(GLOB_RECURSE XML_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.xml)
57+
# for each xml file detected
58+
foreach(XML_FILE_COMPLETE_PATH ${XML_FILES})
59+
# obtain the file name
60+
get_filename_component(XML_FILE ${XML_FILE_COMPLETE_PATH} NAME_WE)
61+
# copy the file from src to build folders
62+
configure_file(
63+
${XML_FILE_COMPLETE_PATH} # from full src path
64+
${CMAKE_CURRENT_BINARY_DIR}/${XML_FILE}.xml # to relative build path
65+
COPYONLY)
66+
install(FILES ${XML_FILE_COMPLETE_PATH}
67+
DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/flow_control/${BIN_INSTALL_DIR})
68+
endforeach()

test/examples/flow_control.compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
2626
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/flow_control@FILE_EXTENSION@
2727
FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/flow_control/flow_control_profile.xml
28-
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ subscriber --samples 10"
28+
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ subscriber --samples 10"
2929

3030
publisher:
3131
image: @DOCKER_IMAGE_NAME@

0 commit comments

Comments
 (0)