Skip to content

Commit

Permalink
add option to export library path for library interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed May 10, 2018
1 parent 0ed476e commit dd707cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -19,6 +19,9 @@
# ``install(TARGETS ... EXPORT name ...)``.
# The ``install(EXPORT ...)`` invocation is handled by this macros.
#
# :param HAS_LIBRARY_TARGET: if set, an environment variable is being defined
# to find the library at runtime executables
# :type HAS_LIBRARY_TARGET: option
# :param ARGN: a list of export names
# :type ARGN: list of strings
#
Expand All @@ -29,11 +32,19 @@ macro(ament_export_interfaces)
message(FATAL_ERROR
"ament_export_interfaces() must be called before ament_package()")
endif()
cmake_parse_arguments(_ARG "HAS_LIBRARY_TARGET" "" "" ${ARGN})

if(${ARGC} GREATER 0)
_ament_cmake_export_interfaces_register_package_hook()
foreach(_arg ${ARGN})
foreach(_arg ${_ARG_UNPARSED_ARGUMENTS})
list(APPEND _AMENT_CMAKE_EXPORT_INTERFACES "${_arg}")
endforeach()

# if the export name contains is a library target
# make sure to register an environment hook
if(${_ARG_HAS_LIBRARY_TARGET})
find_package(ament_cmake_export_libraries QUIET REQUIRED)
_ament_cmake_export_libraries_register_environment_hook()
endif()
endif()
endmacro()
1 change: 1 addition & 0 deletions ament_cmake_export_interfaces/package.xml
Expand Up @@ -10,6 +10,7 @@
<buildtool_depend>ament_cmake_core</buildtool_depend>

<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
<buildtool_export_depend>ament_cmake_export_libraries</buildtool_export_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down

0 comments on commit dd707cc

Please sign in to comment.