Using Build Variable for the paths & symbols on Eclipse CDT

On Eclipse, feature called "Build Variables" enables you to utilize the OS' environment variables as the build variables. In addition you can create your own variables at the same window. Variables can take several form such as String, String List, File, File List, Directory, Directory List, Path, Path List. However, as far as I've tried so far, you can't use String List for the build variable if the list contains more than 1 elements.

For example;
Var name: ROS_PACKAGE_PATH
Var type: String List
Value of Var: /opt/ros/electric/stacks:/home/ros/ros_workspace

Suppose I want to set a Include directory: /opt/ros/electric/stacks/geometry/tf/include. Then you set:
${ROS_PACKAGE_PATH}/geometry/tf/include

Then what happens is first Eclipse expands all the elements in ROS_PACKAGE_PATH variable, then add the concrete expression after the parenthesis which is /geometry/tf/include only at the beginning, which looks like:
-I"/opt/ros/electric/stacks /home/ros/ros_workspace geometry/tf/include"

My slightly tedious workaround is to create new Build Variables, say ROS_DISTRIBUTION_ROOT = /opt/ros/electric/ separately. Can't think of better solution for now but please point out if there is right/ideal way.

Environment) Ubuntu 10.10, Eclipse Indigo

Comments

Popular Posts