linking against soem_beckhof_drivers

Dear List,

For our custom etherCAT driver we have a linking problem. Underneath the CMakelist.txt of the package containing the driver and below that the build error.
How can I link my driver against ${soem_beckhoff_drivers_PACKAGE_PATH}/src/soem_beckhoff_drivers.cpp?

For rosbuild there was no problem since in our tue_ethercat_driver package, we called ros_generate_rtt_typekit(soem_beckhoff_drivers).
However since in Catkin al our packages are in one Cmake project I cannot call this ros_generate_rtt_typekit macro.

Regards Max,

CMakelist.txt:
cmake_minimum_required(VERSION 2.8.3)
project(tue_ethercat_drivers)

find_package(catkin REQUIRED
soem_master
soem_beckhoff_drivers
)

find_package(OROCOS-RTT REQUIRED ${RTT_HINTS} )
include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake)

include_directories(

${catkin_INCLUDE_DIRS}
)

find_package(soem REQUIRED)
include_directories(${soem_INCLUDE_DIRS})

orocos_use_package(soem_master)

#ros_generate_rtt_typekit(soem_beckhoff_drivers)

orocos_plugin(TUeES030 ${soem_beckhoff_drivers_PACKAGE_PATH}/src/soem_beckhoff_drivers.cpp TUeEthercatSlave030.cpp)
target_link_libraries(TUeES030 ${soem_LIBRARIES})
add_dependencies(TUeES030 ${PROJECT_NAME}_generate_messages_cpp)

orocos_generate_package(
INCLUDE_DIRS include
)

BUILD ERROR
CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698 (target_link_libraries):
Target "soem_beckhoff_drivers_generate_messages_cpp" of type UTILITY may
not be linked into another target. One may link only to STATIC or SHARED
libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)

CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698 (target_link_libraries):
Target "soem_beckhoff_drivers_generate_messages_lisp" of type UTILITY may
not be linked into another target. One may link only to STATIC or SHARED
libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)

CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698 (target_link_libraries):
Target "soem_beckhoff_drivers_generate_messages_py" of type UTILITY may not
be linked into another target. One may link only to STATIC or SHARED
libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)

Re: linking against soem_beckhof_drivers

For archiving purposes:

Remove soem_beckhoff_drivers from package.xml and it compiles again.

Ruben Smits's picture

linking against soem_beckhof_drivers

On Wed, Sep 3, 2014 at 1:52 PM, Baeten, M.J.J. <m [dot] j [dot] j [dot] baeten [..] ...>
wrote:

> Dear List,
>
> For our custom etherCAT driver we have a linking problem. Underneath the
> CMakelist.txt of the package containing the driver and below that the build
> error.
> How can I link my driver against
> ${soem_beckhoff_drivers_PACKAGE_PATH}/src/soem_beckhoff_drivers.cpp?
>
>
Why would you want link against a cpp file, what do you want to achieve?

> For rosbuild there was no problem since in our tue_ethercat_driver
> package, we called ros_generate_rtt_typekit(soem_beckhoff_drivers).
> However since in Catkin al our packages are in one Cmake project I cannot
> call this ros_generate_rtt_typekit macro.
>
> Regards Max,
>
> CMakelist.txt:
> cmake_minimum_required(VERSION 2.8.3)
> project(tue_ethercat_drivers)
>
> find_package(catkin REQUIRED
> soem_master
> soem_beckhoff_drivers
> )
>
> find_package(OROCOS-RTT REQUIRED ${RTT_HINTS} )
> include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake)
>
> include_directories(
>
> ${catkin_INCLUDE_DIRS}
> )
>
> find_package(soem REQUIRED)
> include_directories(${soem_INCLUDE_DIRS})
>
> orocos_use_package(soem_master)
>
> #ros_generate_rtt_typekit(soem_beckhoff_drivers)
>
> orocos_plugin(TUeES030
> ${soem_beckhoff_drivers_PACKAGE_PATH}/src/soem_beckhoff_drivers.cpp
> TUeEthercatSlave030.cpp)
>

AFAIK, compiling in a cpp file from another project is not something you
should be doing, as clearly stated by the cmake errors,

I suggest you create a similar cpp file in your own project that serves the
same purpose.

Ruben

> target_link_libraries(TUeES030 ${soem_LIBRARIES})
> add_dependencies(TUeES030 ${PROJECT_NAME}_generate_messages_cpp)
>
> orocos_generate_package(
> INCLUDE_DIRS include
> )
>
> BUILD ERROR
> CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698
> (target_link_libraries):
> Target "soem_beckhoff_drivers_generate_messages_cpp" of type UTILITY may
> not be linked into another target. One may link only to STATIC or SHARED
> libraries, or to executables with the ENABLE_EXPORTS property set.
> Call Stack (most recent call first):
> tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)
>
>
> CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698
> (target_link_libraries):
> Target "soem_beckhoff_drivers_generate_messages_lisp" of type UTILITY may
> not be linked into another target. One may link only to STATIC or SHARED
> libraries, or to executables with the ENABLE_EXPORTS property set.
> Call Stack (most recent call first):
> tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)
>
>
> CMake Error at /opt/ros/hydro/lib/cmake/orocos-rtt/UseOROCOS-RTT.cmake:698
> (target_link_libraries):
> Target "soem_beckhoff_drivers_generate_messages_py" of type UTILITY may
> not
> be linked into another target. One may link only to STATIC or SHARED
> libraries, or to executables with the ENABLE_EXPORTS property set.
> Call Stack (most recent call first):
> tue_ethercat_drivers/CMakeLists.txt:24 (orocos_plugin)
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>