have problems with cmake on Windows 10. I pruned things to the smallest example that will generate the same errors. I run cmake from the Windows command prompt (the same problem occurs with the git bash command-line interpreter, of the Visual Studio command prompt ). My CMakeLists.txt contains three lines:
A MSBuild.exe window pops up briefly with an error message, but I can’t read it. It’s gone too fast.
The command-line window displays this error message:
CMake Error at CMakeLists.txt:3 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
-- Configuring incomplete, errors occurred!
See also "C:/Users/tmpuser/Desktop/SDK/dependencies/DEBUG/CMakeFiles/CMakeOutput.log".
The executable for MSBuild.exe does indeed exist. The CmakeOutput.log file contains:
Thank you. I can run MSBuild.exe from the command line and it doesn’t immediately fail. I’m a Linux guy, and I’ve never used MSBuild before. I don’t know how to tell if it’s fully working. Can you suggest a few command-line options for MSBuild.exe to verify that it was installed and working properly?
The general steps would be to:
Open Visual Studio
Generate a new project with the Console App project (Prints “hello world” to console)
Open the “Developer Command Prompt”
Navigate to where the project .sln was created
Run MSbuild.exe ConsoleApplication1.sln
Watch it build the solution.
This is what I did for Visual Studio 2019 to run MSBuild.exe.
.
I feel like I did my part. I created the minimal cmake configuration that fails. I think you should either tell me what I did was wrong, or cmake is broken and that should be fixed. It should be easy from here.
It is called “Developer Command Prompt for VS 2017”, you can normally find it under Start > Visual Studio 2017 > Developer Command Prompt for VS 2017.
If you really don’t have it, then maybe some required components of VS 2017 are not installed. Please start “Visual Studio Installer”, click on “Modify” and make sure that the “Visual C++ core desktop features” component of the “Desktop development with C++” workload is installed (on the right side).
Okay, thanks for your help. I found the developer prompt. And I got the simple ConsoleApp program to compile with no errors. I’m not sure what this accomplishes.
After following the above instructions for the ConsoleAPp, I tried to run cmake on my simple CMakeLists.txt that had been giving me problems. Now it works. I did nothing different.