When writing a ROS package several tasks often need to be done. These pages give examples of how to handle most of the common ones.
Note
These instructions are for <package format="2">.
If you are making small changes to a format 1 package, please use Package format 1 (legacy) instead. If you are ready to upgrade a format 1 package to format 2, see: Migrating from format 1 to format 2.
Packages almost always use features provided by other packages. Describe all your direct dependencies. Their transitive dependencies on other packages are handled automatically by catkin.
Build targets are generated binaries, shared libraries, message headers, and other objects. Various targets require special handling.
All configuration steps related to testing should be only done conditionally when CATKIN_ENABLE_TESTING is set, which is true by default. Passing -DCATKIN_ENABLE_TESTING=0 to CMake enables configuring and building packages without any testing overhead.
When a format 1 package is revised, it probably makes sense to upgrade its package.xml to format 2.