Skip to content

Commit

Permalink
Install environment hooks into a package-specific directory (#953)
Browse files Browse the repository at this point in the history
* Generate a manifest of env hooks for use by other build tools

* Record full path to hook in manifest

* Install hooks to share/project_name/profile.d

* use `catkin_env_hook` instead of `profile.d` under share/pkgname

* document two install destinations

* spelling
  • Loading branch information
paulbovbel authored and dirk-thomas committed Sep 6, 2018
1 parent 4f5bcd8 commit 7b1e927
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmake/catkin_add_env_hooks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#
# looks for files env-hooks/my_prefix.[bash|tcsh|zsh]((.(devel|install)space)?.[em|in])?
#
# The environment hooks are installed into two destinations:
# * ``etc/catkin/profile.d`` where they can be sourced efficiently by the
# catkin generated ``setup.<shell>`` scripts
# * ``share/${PROJECT_NAME}/catkin_env_hook`` where they can be sourced
# efficiently on a per-package base
#
# :param file_prefix: the filename prefix
# :type file_prefix: string
# :param SHELLS: the shell extensions (e.g.: sh bat bash zsh tcsh)
Expand Down Expand Up @@ -110,6 +116,8 @@ function(catkin_add_env_hooks file_prefix)
if(NOT ${ARG_SKIP_INSTALL})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK}
DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK}
DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook)
endif()
elseif(EXISTS ${base}.in OR EXISTS ${base}.installspace.in)
# evaluate in template and install
Expand All @@ -124,12 +132,16 @@ function(catkin_add_env_hooks file_prefix)
if(NOT ${ARG_SKIP_INSTALL})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK}
DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${ENV_HOOK}
DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook)
endif()
elseif (EXISTS ${base})
# install plain file
if(NOT ${ARG_SKIP_INSTALL})
install(FILES ${base}
DESTINATION ${CATKIN_GLOBAL_ETC_DESTINATION}/catkin/profile.d)
install(FILES ${base}
DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION}/${PROJECT_NAME}/catkin_env_hook)
endif()
endif()
endforeach()
Expand Down

0 comments on commit 7b1e927

Please sign in to comment.