ros/catkin — pull request #167 by tkruse (2012-09-10 16:11:24+00:00)
Title: Symlink fix

(This is an attempt to create a pull request from a fork non-master branch to the main master branch.)

The logic for creating CMakeLists.txt still seems to be flawed. I wrote a unit test for init_workspace and noticed the docstring of init_workspace specified something different from the latest implementation.

So the attached patch changes the logic to:
when linking to toplevel.cmake within workspace use relative path.
Else use absolute path.

Also there was a problem if a user created a workspace with catkin somewhere, using an installed catkin version instead of the catkin version in his workspace. In that case, the init_workspace function would create an absolute link to the installed catkin, not a relative link to the workspace one.

[The more I see this, the less I think it is a good idea to ever allow catkin to live in the same workspace it is used in, as this will always cause non-future-proof hacks.]

Anyway, the patch also detects catkin in the dest workspace via the line in the patch:
workspaces = ['current:' + workspace_dir]

BTW: The whole CATKIN_WORKSPACES logic does not seem to be documented anywhere, I just assumed from the code that this is what is planned.