How let other catkin packages depend on a library built with ExternalProject_Add(...)? [closed]
Hi,
I encountered difficulties wrapping an external driver into a catkin package such that other catkin packages can depend on it. The driver is provided by a company as open-source, it builds without cmake, and it is distributed through a public mercurial repository.
To conveniently pull in upstream updates, I wanted to have the build process checkout and build a specific commit. I know this is discouraged behavior for releasing ROS packages through the build-farm. But for the moment I do not intend to release the package through the build-farm.
I tried using the CMake command ExternalProject_Add because of the following question: http://answers.ros.org/question/63259...
Building the driver library works fine, but any depending catkin package is not aware of the build target for the library. Does anybody know how to properly expose the library and the build target itself to other catkin packages?
Here are the details. In my package igh_eml
I successfully build a library called ethercat
. igh_eml
's CMakeLists.txt looks like this:
project(igh_eml)
find_package(catkin REQUIRED)
catkin_package(
INCLUDE_DIRS ${CATKIN_DEVEL_PREFIX}/include
LIBRARIES ethercat)
include(ExternalProject)
ExternalProject_Add(upstream_igh_eml
# #--Download step----------
HG_REPOSITORY http://hg.code.sf.net/p/etherlabmaster/code # URL of mercurial repo
HG_TAG 792892ab4806 # Mercurial branch name, commit id or tag
TIMEOUT 30 # Time allowed for file download operations
# #--Update/Patch step----------
UPDATE_COMMAND touch <SOURCE_DIR>/config.h COMMAND mkdir -p <SOURCE_DIR>/include <SOURCE_DIR>/lib # Source work-tree update command
# #--Configure step-------------
CONFIGURE_COMMAND touch <SOURCE_DIR>/ChangeLog COMMAND autoreconf -i <SOURCE_DIR> COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-kernel --enable-hrtimer --enable-tool # Build tree configuration command
# #--Build step-----------------
BUILD_IN_SOURCE 1 # Use source dir for build dir
)
ExternalProject_Get_Property(upstream_igh_eml source_dir)
add_custom_command(TARGET upstream_igh_eml POST_BUILD
COMMAND cp
${source_dir}/../../include/ecrt.h
${CATKIN_DEVEL_PREFIX}/include/
)
add_custom_command(TARGET upstream_igh_eml POST_BUILD
COMMAND cp
${source_dir}/../../include/ectty.h
${CATKIN_DEVEL_PREFIX}/include
)
add_custom_command(TARGET upstream_igh_eml POST_BUILD
COMMAND cp
${source_dir}/../../lib/libethercat.so
${CATKIN_DEVEL_PREFIX}/lib
)
Here is a link to the actual file: https://github.com/code-iai/iai_robot...
My second package omnidriver_ethercat
depends on igh_eml
on gives this error:
CMake Error at /home/georg/ros/indigo/boxy_refactoring/devel/share/igh_eml/cmake/igh_emlConfig.cmake:141 (message):
Project 'omni_ethercat' tried to find library 'ethercat'. The library is
neither a target nor built/installed properly. Did you compile project
'igh_eml'? Did you find_package() it before the subdirectory containing its
code is included?
Here is a link to CMakeLists of omnidrive_ethercat
:
https://github.com/code-iai/iai_robot...
Does anybody know how I declare that the library ethercat
will be build through ExternalProject_Add
? Furthermore, how can I make other catkin packages wait for that build target to finish? Thanks in advance for any help!