I've read this link: https://answers.ros.org/question/217475/cmakeliststxt-vs-packagexml/

But still, I can't understand very clearly.

When I try to compile ROS project with the command: catkin_make --install, how and when is the package.xml used? how and when is the CMakeLists.txt used? Both of them must be used?


1 Answer 1


Regarding CMakeLists.txt, it

is the input to the CMake build system for building software packages.

You can think of this file as simply being a list of the cmake build targets and commands for your specific package. It may help to read this to get a general idea.

For package.xml, it

defines properties about the package such as the package name, version numbers, authors, maintainers, and dependencies on other catkin packages.

EDIT: According to an answer in How do I write package.xml? the package.xml is used during the install process to help resolve dependencies.

If you are missing any dependencies and they are not listed in the package.xml file before running catkin_make --install, then your build will either fail or not work as expected.

  • $\begingroup$ If Package.xml is not used by catkin_make to build or install, what is it used for? only for human reading? $\endgroup$
    – Yves
    Jul 4, 2018 at 10:37
  • $\begingroup$ @Yves, package.xml is used to resolve dependencies when installing. Aside from the installation process, the file can be used for human reading. $\endgroup$
    – koverman47
    Jul 4, 2018 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.