0
$\begingroup$

Rosanswers logo

Hi,

I have a project that uses ROS but does not use catkin_make for compiling. I would like to be able to use the ROS message generation in my project but I am running into a problem with the message dependencies.

For example, I have the following file layout:

.
├── a_msgs
│   ├── CMakeLists.txt
│   └── msg
│       └── A.msg
├── b_msgs
│   ├── CMakeLists.txt
│   └── msg
│       └── B.msg
└── CMakeLists.txt

And the contents of the CMakeLists.txt are as follows:

./CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(my_msgs)

add_subdirectory(a_msgs)
add_subdirectory(b_msgs)

./a_msgs/CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(a_msgs)

find_package(catkin REQUIRED)
find_package(message_generation REQUIRED)

add_message_files(
  DIRECTORY
    msg
  FILES
    A.msg
)
generate_messages(
  DEPENDENCIES
    b_msgs
)

./a_msgs/CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(b_msgs)

find_package(catkin REQUIRED)
find_package(message_generation REQUIRED)

add_message_files(
  DIRECTORY
    msg
  FILES
    B.msg
)
generate_messages()

If I were to include b_msgs then a_msgs it would compile without problems, but I cannot change that in our real project. Is there a way to get this to build?

Thank you


Originally posted by jbrindza on ROS Answers with karma: 11 on 2014-02-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Since you message in folder A depend on the messages in folder B you must generate the messages of B before A. Therefore B must be added before A.

If you can't do that for your real project then I am just guessing that your folder A somehow also depends on B which is basically a circular dependency. You might want to extract the messages of B into a third folder in order to come up with a topological order without circular dependencies.


Originally posted by Dirk Thomas with karma: 16276 on 2014-02-13

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.