referencing catkin variables when writing env_hooks

asked 2019-05-16 11:14:54 -0500

ivaughn gravatar image

updated 2019-05-16 12:18:02 -0500

gvdhoorn gravatar image

Is it possible to reference catkin variables when write env_hook templates? It seems that only some things are defined.

For example, I've got an in-house tool that has its own plugin path. An env hook that adds the library directory seems like the correct way to do this. Here's the template file:

export MY_PLUGIN_PATH=$MY_PLUGIN_PATH:@(CATKIN_DEVEL_PREFIX)/@(CATKIN_PACKAGE_LIB_DESTINATION)

Now we add the following to the CMakeLists.txt:

catkin_add_env_hooks(setup_my_path SHELLS bash DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)

However, the generated bash script in the install space is always:

export MY_PLUGIN_PATH=$MY_PLUGIN_PATH:/path/to/my_ws/devel/

It seems to work if I use @(CATKIN_GLOBAL_LIB_DESTINATION), which suggests there's something buggy in how the context.py file that gets passed to the em expander is formed. In fact, CATKIN_PACKAGE_LIB_DESTINATION is set to an empty string in the context.py file but the global one isn't.

Or do I just misunderstand how Global vs. Package paths work?

edit retag flag offensive close merge delete

Comments

Can you print the content of both variables right before you call catkin_add_env_hooks(...)? message("CATKIN_PACKAGE_LIB_DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}") and message("CATKIN_GLOBAL_LIB_DESTINATION ${CATKIN_GLOBAL_LIB_DESTINATION}")

Dirk Thomas gravatar image Dirk Thomas  ( 2019-05-16 16:36:11 -0500 )edit