[ros-users] rosmake --dist?

Lorenz Mösenlechner moesenle at in.tum.de
Mon May 31 23:37:05 UTC 2010


Hi,

calling 'cmake CMakeLists.txt' in your package directory should
overwrite your existing Makefile with a cmake generated one. I'm not
sure if this is what you want to do and calling cmake outside a
dedicated build directory is not the right way to use cmake anyway.

Rosmake doesn't know the distclean target that you added to your
CMakeLists.txt because it just calls make in your project
directory. If you have a look at the common Makefile that is created,
for instance, by roscreate-pkg, it only contains the line:

include $(shell rospack find mk)/cmake.mk

You can easily enable the dist-clean target by adding the following
lines after the above include line:

distclean:
        cd build && make distclean

Note that before the 'cd build' in the above Makefile snippet, you
must put a tab. Otherwise, make will not be able to read the file
correctly.

Lorenz

> If I add this to CMakeLists.txt
> 
> add_custom_target(distclean rm -r ${PROJECT_SOURCE_DIR}/bin
>   COMMAND rm -r ${PROJECT_SOURCE_DIR}/build
>   COMMAND rm -r ${PROJECT_SOURCE_DIR}/CMakeFiles
>   COMMAND rm ${PROJECT_SOURCE_DIR}/CMakeCache.txt
>   COMMAND rm ${PROJECT_SOURCE_DIR}/cmake_install.cmake
>   COMMAND rm ${PROJECT_SOURCE_DIR}/Makefile
>   COMMAND perl -e 'print qq|include \\x24\(shell rospack find mk
> \)/cmake.mk|' > ${PROJECT_SOURCE_DIR}/Makefile
>   WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>   COMMENT "Preparing for distribution")
> 
> This does not work...
> $ rosmake --target=distclean my_pkg
> 
> [rosmake-1] >>> xmlrpcpp >>> [ make distclean ]
> [ rosmake ] All 1 lines
> {-------------------------------------------------------------------------------
> -------------------------------------------------------------------------------}
> [rosmake-1] <<< xmlrpcpp <<< [SKIP] No rule to make target distclean
> [ rosmake ] Halting due to failure in package xmlrpcpp.
> 
> 
> This does not work either...
> $ rosmake -r --target=distclean my_pkg
> 
> [rosmake-1] >>> my_pkg >>> [ make distclean ]
> [ rosmake ] All 1 lines
> {-------------------------------------------------------------------------------
> -------------------------------------------------------------------------------}
> [rosmake-1] <<< my_pkg <<< [SKIP] No rule to make target distclean
> 
> 
> This seems to work
> $ cmake CMakeLists.txt &&  make distclean
> 
> Is there a better way to do this?
> 
> On Sun, 2010-05-30 at 23:39 -0400, Bill Morris wrote: 
> > Is there anything that prepares a package for check-in to version
> > control?
> > 
> > I would like a build target like $ rosmake --dist package_name that
> > removes
> > 
> > bin/
> > build/
> > CMakeCache.txt
> > CMakeFiles
> > cmake_install.cmake
> > 
> > and sets the contents of Makefile to
> > "include $(shell rospack find mk)/cmake.mk"
> 
> 
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
> 



More information about the ros-users mailing list