cmake --build show exact command executed

I use VS generator. How can I see the exact command line cmake --build issues when it invokes msbuild.exe to build the project? Even if I use the -v (verbose) flag, it only displays msbuild output, but not how msbuild was invoked exactly.

It looks like CMake gathers it, but throws it away in the cmake --build codepath. Looking at the code, it’s something like <msbuild> <project>.sln /build <config> /project <target> <options…>. I think using a CTest script and ctest_build would show the output though with enough verbosity.

https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8183

2 Likes