Build a single package including it's dependencies
catkin_make --only-pkg-with-deps <target_package>
Don't forget to switch back to building all packages when you are done
catkin_make -DCATKIN_WHITELIST_PACKAGES=""
Description
Whitelists only the specified packages and their dependencies by setting the CATKIN_WHITELIST_PACKAGES variable. This variable is stored in CMakeCache.txt and will persist between CMake calls unless explicitly cleared. Source: catkin_make --help
But there is an even better way
Using Catkin-Tools:
sudo apt-get install python-catkin-tools
Build specific package
catkin build <target_package>
Build the package from a directory under the package root
catkin build --this
Advantages:
- you can call
catkin build
from everywhere - always builds packages seperately
catkin clean
cleans everything (instead of the dangerous rm -rf build devel
) - more infos
Important notes for catkin_tools:
- You can't mix
catkin build
and catkin_make
(delete your build/devel/install folders to switch tools) - As
catkin_build
builds all packages seperately there can be problems when passing information between packages via CMake. More Information
Old answer for legacy reasons
catkin_make --pkg <my_package_name>
Example:
catkin_make --pkg turtlebot
Multiple Packages:
catkin_make --pkg <package A> <package B>
But as this doesn't work robustly I recommend switching to catkin_tools which allows to build only one package and many more fancy features: