Ask Your Question
1

what does add_dependence() do?

asked 2017-08-31 13:45:20 -0600

roovie gravatar image

updated 2017-08-31 15:08:18 -0600

jayess gravatar image

Hi, I am a new learner of ROS.

Recently, I created a package called beginner.

Then I did the test called WritingPublisherSubscriber.

When I added context into CMakeLists.txt, I copied directly

add_dependencies(listener beginner_turorials_generate_message_cpp)
add_dependencies(talker beginner_turorials_generate_message_cpp)

rather than

add_dependencies(listener beginner_generate_message_cpp)
add_dependencies(talker beginner_generate_message_cpp)

After I compiled it, the program ran nornally.

I was very confused about it.

Please tell me what happened inside

edit retag flag offensive close merge delete

Comments

1

Welcome. I edited your question for you, but in the future please use the 101010 button to format your text to make it more readable. You may find that you get more attention with well-formatted questions.

jayess gravatar imagejayess ( 2017-08-31 15:09:39 -0600 )edit

thanks a lot

roovie gravatar imageroovie ( 2017-08-31 21:29:15 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-10-26 10:13:26 -0600

According to add_dependencies's documentation:

Add a dependency between top-level targets.

add_dependencies(<target> [<target-dependency>]...)

Make a top-level <target> depend on other top-level targets to ensure that they build before <target> does. A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, or ADD_CUSTOM_TARGET. Dependencies added to an IMPORTED target are followed transitively in its place since the target itself does not build.

See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom rules. See the OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add file-level dependencies to object files.

edit flag offensive delete link more

Comments

And just to note: @roovie: this is not something we made up in ROS, but is a piece of CMake infrastructure to allow you to express dependencies between (make) targets.

gvdhoorn gravatar imagegvdhoorn ( 2017-10-26 10:30:09 -0600 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2017-08-31 13:45:20 -0600

Seen: 79 times

Last updated: Oct 26 '17