Ask Your Question

Commit generated CMakeLists.txt in Git?

asked 2018-12-06 14:10:46 -0600

jinhkim gravatar image

updated 2018-12-06 14:06:25 -0600

When I build the ROS project I'm working on, I have a generated CMakeLists.txt in my root folder that points to /opt/ros/melodic/share/catkin/cmake/toplevel.cmake. We already have it committed, but I don't think it should be, since it's generated every time I run catkin_make. What's the best practice for ROS?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-06 14:18:38 -0600

updated 2018-12-06 14:21:04 -0600

Indeed, you should not be tracking that file in Git. You should be counting on catkin_make or catkin_init_workspace to auto-generate that file.

Moreover, if you are tracking that file in Git it sounds to me like potentially the root of your Git repository is not in the right place. For ROS, nearly all Git repositories contain either a single package/metapackage, or a collection of packages bundled together with a metapackage that depends on all of the packages. An example of the first situation might be usb_cam, where the Git repo is initialized in the package's root directory. For an example of the second situation, the ros_tutorials Git repository has a metapackage called ros_tutorials that depends on roscpp_tutorials, rospy_tutorials and turtlesim, and the source code for all of those packages is also in the Git repo. Put another way, you should be running git init in either a package's root directory or in a directory containing a collection of packages. You should not be running git init in the src/ directory of a workspace.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-12-06 14:06:25 -0600

Seen: 387 times

Last updated: Dec 06 '18