ros/catkin — pull request #673 by JonathanWade (2014-07-02 19:21:21+00:00)
Title: Delayed expansion for indexed catkin env hooks in windows

This pull request on win_ros will provide a lot of context: [win_ros pull request #44](https://github.com/ros-windows/win_ros/pull/44)

This is a workable solution to use the new indexed style catkin environment hooks (new to the windows people in the move from 0.5.69 :arrow_right: 0.5.78). It works in my local environment where I'm using Catkin 0.5.78 with the rest of the windows hydro stack.

Although it works its far from ideal:

1. Delayed expansion is confusing and not intuitive (hence provided comments for those that want to watch the steps in the expansion)
2. `setlocal/endlocal` is a scoping mechanism that destroys all variables created in the scope. This requires explicit capture of the variables at `endlocal`. This requires knowledge of what the end environment should contain.
3. The `_CATKIN_ENVIRONMENT_HOOKS_XXX` variables are not removed from the environment at the end of the script. I tried this using delayed expansion but it never seemed to work. I assume leaving these env variables present will do no harm to the run time.

Related pull requests for files called via the `_CATKIN_ENVIRONMENT_HOOKS_XXX` are here:

* [ROS pull request 60](https://github.com/ros/ros/pull/60)
* [ros-windows/ros_comm pull request 2](https://github.com/ros-windows/ros_comm/pull/2)