Skip to content

Commit

Permalink
Refs #21185: Copy xml file in the build folder
Browse files Browse the repository at this point in the history
Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com>
  • Loading branch information
elianalf committed Jul 17, 2024
1 parent 84125ad commit 0d50b77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples/cpp/flow_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ target_compile_definitions(flow_control PRIVATE
target_link_libraries(flow_control fastdds fastcdr foonathan_memory)
install(TARGETS flow_control
RUNTIME DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/flow_control/${BIN_INSTALL_DIR})

# Copy the XML files over to the build directory
file(GLOB_RECURSE XML_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.xml)
# for each xml file detected
foreach(XML_FILE_COMPLETE_PATH ${XML_FILES})
# obtain the file name
get_filename_component(XML_FILE ${XML_FILE_COMPLETE_PATH} NAME_WE)
# copy the file from src to build folders
configure_file(
${XML_FILE_COMPLETE_PATH} # from full src path
${CMAKE_CURRENT_BINARY_DIR}/${XML_FILE}.xml # to relative build path
COPYONLY)
install(FILES ${XML_FILE_COMPLETE_PATH}
DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/flow_control/${BIN_INSTALL_DIR})
endforeach()
2 changes: 1 addition & 1 deletion test/examples/flow_control.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/flow_control@FILE_EXTENSION@
FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/flow_control/flow_control_profile.xml
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ subscriber --samples 10"
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/flow_control@FILE_EXTENSION@ subscriber --samples 10"

publisher:
image: @DOCKER_IMAGE_NAME@
Expand Down

0 comments on commit 0d50b77

Please sign in to comment.