Skip to content

Commit

Permalink
Merge branch 'catkin_isolated_dummy_lib_test' of https://github.com/g…
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun-edwards committed Jan 14, 2014
2 parents 511cded + 9df4697 commit abcef32
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
7 changes: 6 additions & 1 deletion industrial_robot_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ catkin_package(
simple_message actionlib_msgs actionlib urdf industrial_msgs
industrial_utils
INCLUDE_DIRS include
)
)



include_directories(include
${catkin_INCLUDE_DIRS}
)


# do some trickery with the linker for simple_message
simple_message_linker_setup()


# This library depends on the simple_message library, which is available
# in two formats to support endian differences between robot & PC.
#
Expand Down
18 changes: 17 additions & 1 deletion simple_message/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,30 @@ set(UTEST_SRC_FILES test/utest.cpp test/utest_message.cpp)

catkin_package(
CATKIN_DEPENDS roscpp industrial_msgs
INCLUDE_DIRS include
INCLUDE_DIRS include
LIBRARIES simple_message_dummy
CFG_EXTRAS simple_message_linker_setup.cmake
)


include_directories(include
${catkin_INCLUDE_DIRS}
)


# generate dummy library (we export it in catkin_package(..)), to force catkin
# to set up simple_message_LIBRARY_DIRS properly.
# TODO: find out if LIBRARY_DIRS can be exported without dummy library target
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/simple_message_dummy.cpp
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/simple_message_dummy.cpp)
add_library(simple_message_dummy ${CMAKE_CURRENT_BINARY_DIR}/simple_message_dummy.cpp)
# unfortunately this will have to be installed, but the linker will remove it
# from the library dependencies of dependent targets, as it contains no symbols
# that can be imported from it.
install(TARGETS simple_message_dummy DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})


# NOTE: All test files require TEST_PORT_BASE to be defined. Defining different
# ports for each test executable allows them to run in parallel.

Expand Down
9 changes: 9 additions & 0 deletions simple_message/cmake/simple_message_linker_setup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

function(simple_message_linker_setup)
if (DEFINED simple_message_LIBRARY_DIRS)
else()
message(FATAL_ERROR "simple_message_LIBRARY_DIRS not set, "
"have you find_package()-ed it?")
endif()
link_directories(${simple_message_LIBRARY_DIRS})
endfunction()

0 comments on commit abcef32

Please sign in to comment.