Run CMake executable targets via the cmake command
https://a4z.noexcept.dev/blog/2026/05/23/CMake-Run-Targets.htmlEvery time I use bazel for a while, and come back to CMake, I notice that I miss a cmake --run command. Bazel has a bazel run //target command.
We can not do that with cmake, but something similar.
20
Upvotes
View all comments
Show parent comment
3
u/13steinj May 24 '26
What are you talking about?
"Making a different build directory" is something you do with every build system. Running
cmake -S <src> -B <build>to specify where to place your configured files is also a common step in many build systems (well, the equivalent of this). Then justcmake --buildyour test binary target, or your test target to build and run.Bazel hiding this from you isn't some magical benefit.
People also get confused about some sneaky semantics
bazel runhas, some only fixed in Bazel 9.I don't understand how people become zealots for a build system. Use the thing that fits your actual need. Sometimes that's Bazel (not in my experience, tbph), sometimes that's cmake, sometimes that's make, sometimes it's autoconf.