Robotics StackExchange | Archived questions

CMakeLists.txt for ROS while using ZeroMQ

Hi, I am trying to use ZeroMQ in ROS C++. I am looking for CMakeLists.txt file for ZeroMQ. From Google, I found that there is a ROS Package to do it. However, it seems that this package downloads and compiles ZeroMQ first.

I already have ZeroMQ installed and working fine. Hence I don't want to install it again. I have written a standalone C++ ZeroMQ code, which works fine but I am not able to compile it with ROS. Since I don't know CMakeLists.txt.

Please have a look at the following CMakeLists.txt files:

[ROS]CMakeLists.txt (This is the ROS file, which I am looking for. Unfortunately, this is not working.)

cmake_minimum_required(VERSION 2.8.3)
project(learning_zeromq_ros)

find_package(catkin REQUIRED COMPONENTS roscpp)
catkin_package()
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(data_publisher src/data_publisher.cpp)
target_link_libraries(data_publisher ${catkin_LIBRARIES})

[Standalone]CMakeLists.txt (This is standalone file and it is working properly.)

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(learning_zeromq_standalone)
set(CMAKE_CXX_STANDARD 11)

find_package(PkgConfig)
pkg_check_modules(PC_ZeroMQ QUIET zmq)
find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.hpp PATHS ${PC_ZeroMQ_INCLUDE_DIRS})
find_library(ZeroMQ_LIBRARY NAMES zmq PATHS ${PC_ZeroMQ_LIBRARY_DIRS})

set(SOURCE_FILES data_publisher.cpp)
add_executable(data_publisher ${SOURCE_FILES})
target_include_directories(data_publisher PUBLIC ${ZeroMQ_INCLUDE_DIR})
target_link_libraries(data_publisher PUBLIC ${ZeroMQ_LIBRARY})

I want to know the CMakeLists.txt for ROS while using ZeroMQ. Please note that I am using ROS Indigo on Ubuntu 14.04 LTS PC. Thank you very much.

Asked by ravijoshi on 2017-11-24 10:06:55 UTC

Comments

This is really not a ROS question, but a CMake one. It would probably be better if you ask this on a more suitable support forum.

this is not working.

and this is not enough information.

Asked by gvdhoorn on 2017-11-24 11:53:00 UTC

Answers