Ask for guide about updating CMakeLists.txt and package.xml

Hi there,

I noticed that I can run Python scripts without updating the CMakeLists.txt and package.xml.
I guess it is because the course environment has installed these packages.

Could you please provide a guide about updating these two files?
I took some notes during learning but not sure if it covers everything.


find_package(catkin REQUIRED COMPONENTS
  dependency_name # add new dependencies here

  # INCLUDE_DIRS include  # Uncomment if you have headers in include directory
  LIBRARIES your_package_name
  CATKIN_DEPENDS dependency_name #add new dependencies here
  # DEPENDS system_lib  # Uncomment if you have dependencies on system libraries

catkin_install_python(PROGRAMS scripts/ 
# add Python script path for each Python script




As for the customerized .msg/.srv, the guides are already very clear so I ignore them here.

Hi , our best “guide” would be our course itself, but I understand that you want to have a quick guide, so here’s one:

  • The CMakeLists.txt file in packages is used by CMake to configure their build process. You are able to run python scripts probably only on the path where the script is, and luckily the program doesn’t depend on any other package.
  1. Find necessary packages:
cmake_minimum_required(VERSION 3.0.2)

find_package(catkin REQUIRED COMPONENTS
  # Add other dependencies here
  1. Declare the catkin package:
  CATKIN_DEPENDS rospy std_msgs
  # Other dependencies
  1. Install python scripts:
  • package.xml is used to specify package info and dependencies. The example you provide is perfect for most cases.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.