colcon / colcon-core

Command line tool to build sets of software packages
http://colcon.readthedocs.io
Apache License 2.0
103 stars 46 forks source link

CLI UX - build a workspace from a different working directory #498

Open alecGraves opened 2 years ago

alecGraves commented 2 years ago

Many CLI build / file-manipulation tools contain convenience arguments for running a command that operates on a different directory than your current working directory:

~ $ make -C my/makefile/project
~ $ ninja -C my/ninja/builddir
~ $ meson compile -C my/meson_project/builddir
~ $ meson test -C my/meson_project/builddir
~ $ catkin_make -C my/ros1/catkin_ws
~ $ git -C my/git/project
~ $ catkin build --workspace my/ros1/catkin_ws

Currently, with colcon build, you can accomplish this using something like the following:

~ $ p=my/colcon/ws eval 'colcon --log-base $p/log build --base-paths $p --build-base $p/build --install-base $p/install'

...but this is rather cumbersome. A -C or --directory arg for colcon build that defaults log, build, install, and package paths would be more familiar to many developers.