Skip to content

Commit 0f1c31e

Browse files
committed
escape ; as \; when passing a PATH list as an env var on Windows
1 parent dd33628 commit 0f1c31e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎rclpy/CMakeLists.txt‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ if(AMENT_ENABLE_TESTING)
9696
ament_lint_auto_find_test_dependencies()
9797

9898
rosidl_generator_py_get_typesupports(_typesupport_impls)
99-
ament_index_get_prefix_path(ament_prefix_path_list)
100-
# Do this even on Windows, because the Python run_test.py will handle the : vs ; issues.
101-
string(REPLACE ";" ":" ament_prefix_path "${ament_prefix_path_list}")
99+
ament_index_get_prefix_path(ament_prefix_path)
102100
if(WIN32)
101+
# On Windows prevent CMake errors and prevent it being evaluated as a list.
103102
string(REPLACE "\\" "/" ament_prefix_path "${ament_prefix_path}")
103+
# TODO(wjwwood): change this when we have a better way to pass PATH lists
104+
# to environment variables on Windows.
105+
string(REPLACE ";" "\;" ament_prefix_path "${ament_prefix_path}")
106+
else()
107+
# Otherwise convert the CMake list into a :-separated Unix like PATH list.
108+
string(REPLACE ";" ":" ament_prefix_path "${ament_prefix_path}")
104109
endif()
105110
if(NOT "${_typesupport_impls} " STREQUAL " ")
106111
ament_add_nose_test(rclpytests test

0 commit comments

Comments
 (0)