I am configuring/building a CMake project (Google Test) in Visual Studio. I want to see the full command that is run to perform the build (I’m interested in verifying the state of the --config
flag in the cmake.exe
invocation, as related to this question).
The CMake output is already verbose appropriate to my needs: it shows the cmake.exe
invocation (edited for brevity):
...
1> PUBLIC=C:UsersPublic
1> VSAPPIDNAME=devenv.exe
1> MSBuildLoadMicrosoftTargetsReadOnly=true
1> Command line: "C:WINDOWSsystem32cmd.exe" /c "%SYSTEMROOT%System32chcp.com 65001 >NUL && "c:program filesmicrosoft visual studio2022enterprisecommon7idecommonextensionsmicrosoftcmakeCMakebincmake.exe" -G "Visual Studio 17 2022" -DCMAKE_C_COMPILER:STRING="cl.exe" -DCMAKE_CXX_COMPILER:STRING="cl.exe" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:/dev/googletest/out/vs/install/x64-debug" "C:devgoogletest" 2>&1"
1> Working directory: C:/dev/googletest/out/vs/build/x64-debug
1> [CMake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
1> [CMake] -- Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
...
Even though I have already explicitly set Tools > Options > Projects and Solutions > Build And Run > MSBuild project build output and verbosity
to “Normal” (and then later to “Detailed”) per this answer…
…the build output is sparse, and does not include any actual invoked commands:
>------ Build All started: Project: googletest, Configuration: x64-debug ------
MSBuild version 17.8.5+b5265ef37 for .NET Framework
1>Checking Build System
Building Custom Rule C:/dev/googletest/googlemock/CMakeLists.txt
gtest-all.cc
gmock-all.cc
Generating Code...
gmock.vcxproj -> C:devgoogletestoutvsbuildx64-debuglibDebuggmock.lib
Building Custom Rule C:/dev/googletest/googlemock/CMakeLists.txt
gtest-all.cc
gmock-all.cc
gmock_main.cc
Generating Code...
gmock_main.vcxproj -> C:devgoogletestoutvsbuildx64-debuglibDebuggmock_main.lib
Building Custom Rule C:/dev/googletest/googletest/CMakeLists.txt
gtest-all.cc
gtest.vcxproj -> C:devgoogletestoutvsbuildx64-debuglibDebuggtest.lib
Building Custom Rule C:/dev/googletest/googletest/CMakeLists.txt
gtest_main.cc
gtest_main.vcxproj -> C:devgoogletestoutvsbuildx64-debuglibDebuggtest_main.lib
Building Custom Rule C:/dev/googletest/CMakeLists.txt
Build All succeeded.
I also don’t see any difference in the build output between “Normal” and “Detailed” levels of verbosity.
In Tools > Options > CMake > General
, I’ve also enabled the relevant-looking Enable verbose CMake output
option.
My question is: can Visual Studio (2022) be configured to output the actual command invoked when performing a build through the GUI?
(I’m specifically interested in seeing (what I assume will be) cmake.exe --build ... --config ...
invocations)
By way of comparison, here’s the build output from Visual Studio Code, which does show the actual invoked command:
[main] Building folder: googletest
[build] Starting build
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" --build C:/dev/googletest/out/vs/build/x64-release --config release --target ALL_BUILD
[build] MSBuild version 17.8.5+b5265ef37 for .NET Framework
[build]
[build] 1>Checking Build System
[build] Building Custom Rule C:/dev/googletest/googlemock/CMakeLists.txt
[build] gtest-all.cc
[build] gmock-all.cc
[build] Generating Code...
[build] gmock.vcxproj -> C:devgoogletestoutvsbuildx64-releaselibReleasegmock.lib
[build] Building Custom Rule C:/dev/googletest/googlemock/CMakeLists.txt
[build] gtest-all.cc
[build] gmock-all.cc
[build] gmock_main.cc
[build] Generating Code...
[build] gmock_main.vcxproj -> C:devgoogletestoutvsbuildx64-releaselibReleasegmock_main.lib
[build] Building Custom Rule C:/dev/googletest/googletest/CMakeLists.txt
[build] gtest-all.cc
[build] gtest.vcxproj -> C:devgoogletestoutvsbuildx64-releaselibReleasegtest.lib
[build] Building Custom Rule C:/dev/googletest/googletest/CMakeLists.txt
[build] gtest_main.cc
[build] gtest_main.vcxproj -> C:devgoogletestoutvsbuildx64-releaselibReleasegtest_main.lib
[build] Building Custom Rule C:/dev/googletest/CMakeLists.txt
[driver] Build completed: 00:00:11.905
[build] Build finished with exit code 0
[cpptools] The build configurations generated do not contain the active build configuration. Using "Debug" for CMAKE_BUILD_TYPE instead of "release" to ensure that IntelliSense configurations can be found