Difference between find_package, message_generation etc in Cmake file

Hi, couple of doubts:

  1. when we use source devel/setup.bash, is it safe to say that we are restarting that particular shell with the updated values environmental or export values?

  2. for message file creation,in the Cmake file, what is the difference between find_package(), message_generation() and catkin_package(). Based on my understanding from reading the comments in the Cmake file, they are all pretty much the same and makes that package available to that function. so why didn’t who ever created this system, replace them with just one of the above-mentioned functions instead of three.

Hi @Joseph1001 ,

  1. No, I wouldn’t say that we are restarting the terminal. You source the workspace to the places where the ROS system can find packages. You can have more than two sourced workspaces, like catkin_ws/devel and /opt/ros/distro/.

  2. Well, message_generation() is where you define messages of your package specifically, and find_package() and catkin_package() are related to the packages that you want discoverable in your workspace, so for me at least it helps to keep things modular and more understandable.

Hi @roalgoal , thanks for reply.

Can you tell me what exactly is the difference between find_package() and catkin_package()?

find_package() contains all the packages needed to compile messages of topics ,services etc

generate_message() contains the packages for message creation , which is mentioned inside find_package()

catkin_package() needed for executing something from the package.

if all the packages in generate_message() are found inside find_package() and find_package() was created to hold package to accommodate message generation, then whats the need for having two?