CMake busybox?

Inspired by [RFC] LLVM Busybox Proposal - LLVM Dev List Archives - LLVM Discussion Forums
TLDR: Merge all utilities into single executable and dispatch them by argv[0] dynamically.

I saw in CMake build script cmake, ctest and cpack share many objects. So is it worth or possible to combine them? If so, the size of the software package would be greatly reduced.

I’ve thought about doing this a few times. I think that at least at one time there may have been some differences in system dependencies that justified separate binaries, but I think those may be resolved. Mainly it’s a matter of someone taking the time to do this.

ccmake and cmake-gui also re-use many of cmake’s objects, but they do have extra dependencies. Long term I’d like to see those re-architected to have only the TUI/GUI code and internally execute cmake as a separate process instead of linking it.

Tried locally, by adding a simple generic driver and linking every thing into one executable. On my platform, macOS, the final artifact in bin is about 13MB, all dependencies are from system. But I met some issues in bootstrap script and macOS bundle structures…