Ask Your Question
0

building message packages outside of catkin_make

asked 2014-02-12 09:21:36 -0600

jbrindza gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-02-13 05:16:15 -0600

Dirk Thomas gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-02-12 09:21:36 -0600

Seen: 224 times

Last updated: Feb 13 '14