From 873b97a9cf31f6b8c6f46ead2b526ec21ef02481 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 20 Nov 2018 19:59:57 -0800 Subject: [PATCH] make tuple conversation safe on Windows --- .../cmake/rosidl_generate_interfaces.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake b/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake index 46a32812a..54851bc1e 100644 --- a/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake +++ b/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake @@ -77,7 +77,7 @@ macro(rosidl_generate_interfaces target) "file '${_file}' must be represented as an absolute base path " "separated by a colon from the relative path to the interface file") endif() - string(REPLACE ":" "/" _abs_file "${_file}") + string(REGEX REPLACE ":([^:]*)$" "/\\1" _abs_file "${_file}") if(NOT EXISTS "${_abs_file}") message(FATAL_ERROR "rosidl_generate_interfaces() the passed file " "'${_abs_file}' doesn't exist") @@ -96,7 +96,7 @@ macro(rosidl_generate_interfaces target) # stamp all interface files foreach(_tuple ${_interface_tuples}) - string(REPLACE ":" "/" _abs_interface "${_tuple}") + string(REGEX REPLACE ":([^:]*)$" "/\\1" _abs_interface "${_tuple}") stamp("${_abs_interface}") endforeach() @@ -149,14 +149,14 @@ macro(rosidl_generate_interfaces target) set(_non_idl_files "") foreach(_tuple ${_non_idl_tuples}) - string(REPLACE ":" "/" _non_idl_file "${_tuple}") + string(REGEX REPLACE ":([^:]*)$" "/\\1" _non_idl_file "${_tuple}") list(APPEND _non_idl_files "${_non_idl_file}") # Split .srv into two .msg files get_filename_component(_extension "${_tuple}" EXT) # generate request and response messages for services if(_extension STREQUAL ".srv") - string(REPLACE ":" ";" _list "${_tuple}") + string(REGEX REPLACE ":([^:]*)$" ";\\1" _list "${_tuple}") list(GET _list 1 _relpath) get_filename_component(_name "${_relpath}" NAME_WE) get_filename_component(_parent_folder "${_relpath}" DIRECTORY) @@ -233,7 +233,7 @@ macro(rosidl_generate_interfaces target) # register interfaces with the ament index set(_idl_files_lines) foreach(_idl_tuple ${_idl_tuples}) - string(REPLACE ":" ";" _idl_list "${_idl_tuple}") + string(REGEX REPLACE ":([^:]*)$" ";\\1" _idl_list "${_idl_tuple}") list(GET _idl_list 1 _idl_relpath) file(TO_CMAKE_PATH "${_idl_relpath}" _idl_relpath) list(APPEND _idl_files_lines "${_idl_relpath}") @@ -307,9 +307,9 @@ macro(rosidl_generate_interfaces target) if(NOT _ARG_SKIP_INSTALL) foreach(_idl_tuple ${_idl_tuples}) - string(REPLACE ":" ";" _idl_list "${_idl_tuple}") + string(REGEX REPLACE ":([^:]*)$" ";\\1" _idl_list "${_idl_tuple}") list(GET _idl_list 1 _idl_relpath) - string(REPLACE ":" "/" _idl_file "${_idl_tuple}") + string(REGEX REPLACE ":([^:]*)$" "/\\1" _idl_file "${_idl_tuple}") get_filename_component(_parent_folders "${_idl_relpath}" DIRECTORY) install( FILES ${_idl_file}