diff --git a/colcon_cmake/task/cmake/build.py b/colcon_cmake/task/cmake/build.py index 17149e5..3fa222f 100644 --- a/colcon_cmake/task/cmake/build.py +++ b/colcon_cmake/task/cmake/build.py @@ -64,6 +64,12 @@ def add_arguments(self, *, parser): # noqa: D102 '--cmake-force-configure', action='store_true', help='Force CMake configure step') + parser.add_argument( + "--cmake-build-args", metavar='*', type=str.lstrip, + nargs='*', + help='Pass arguments to cmake --build. ' + 'Arguments matching other options must be prefixed by a space,\n' + 'e.g. --cmake-build-args " --parallel" 4') async def build( # noqa: D102 self, *, additional_hooks=None, skip_hook_creation=False, @@ -237,6 +243,8 @@ async def _build(self, args, env, *, additional_targets=None): cmd += ['--clean-first'] if multi_configuration_generator: cmd += ['--config', self._get_configuration(args)] + if args.cmake_build_args: + cmd += args.cmake_build_args else: job_args = self._get_make_arguments(env) if job_args: