ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How can i copy non-binary files into my binaries directory with catkin and cmake?

asked 2016-07-15 09:01:12 -0600

Robert Grönsfeld gravatar image

Hi, I have a benchmarking executable in my project which pulls data from bagfiles. Now I want to copy the folder with my bagfiles into the directory where my binaries end up, because I have hardcoded paths to them in my code. I already tried to copy the folder with my bagfiles by adding this line to my CMakeLists.txt:

file(COPY src/benchmarking/bagfiles DESTINATION ${CMAKE_BINARY_DIR})

Unfortunately the variable CMAKE_BINARY_DIR only contains the absolute path to my source directory. Is there a variable that points to the binaries directory?

edit retag flag offensive close merge delete


Just a suggestion: if you place your bagfiles in a (skeleton) ROS pkg, you could use rospack find $bag_pkg to parameterise the location. Could potentially remove the need for hard-coded paths.

Alternatively, you could make the paths parameters, and provide the absolute paths at runtime.

gvdhoorn gravatar image gvdhoorn  ( 2016-07-15 10:55:47 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-07-15 09:44:19 -0600

Robert Grönsfeld gravatar image


See also this post.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-07-15 09:01:12 -0600

Seen: 2,782 times

Last updated: Jul 15 '16