Skip to content

Commit

Permalink
Fix ros/catkin#694 by modifying rosbuild to strip leading -l: from li…
Browse files Browse the repository at this point in the history
…braries.
  • Loading branch information
gerkey authored and evenator committed Mar 2, 2016
1 parent 0036866 commit 42f286f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/rosbuild/core/rosbuild/public.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,25 @@ macro(rosbuild_init)
list(REVERSE ${_prefix}_LIBRARIES)
endif()

# Strip the leading ':' from any library that was given to us as
# ':/path/to/lib'. Those kinds of libraries generally come from
# catkin-generated .pc files that are parsed by rospack via pkg-config.
# Newer versions of ld (and gold) don't accept the '-l:/path/to/lib'
# syntax. They've long accepted the '/path/to/lib' syntax, so it
# should be safe to just strip the ':' here. We could remove it at
# the source, from the .pc file, but the lib argument needs to start
# with '-l' to ensure proper ordering of libs in the return from
# pkg-config.
# https://github.com/ros/catkin/issues/694
if(${_prefix}_LIBRARIES)
set(_${_prefix}_LIBRARIES ${${_prefix}_LIBRARIES})
set(${_prefix}_LIBRARIES "")
foreach(_lib ${_${_prefix}_LIBRARIES})
string(REGEX REPLACE "^:/" "/" _lib_nocolon ${_lib})
list(APPEND ${_prefix}_LIBRARIES ${_lib_nocolon})
endforeach(_lib)
endif()

# Also throw in the libs that we want to link everything against (only
# use case for this so far is -lgcov when building with code coverage
# support).
Expand Down

0 comments on commit 42f286f

Please sign in to comment.