0

I 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:

cmake_minimum_required(VERSION 3.1)

project(DEBUG bogus)

I run cmake this way:

cmake -G "Visual Studio 15 2017 Win64" .

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:

The system is: Windows - 10.0.17763 - AMD64

Does anyone know what is wrong?

JB_User
  • 3,117
  • 7
  • 31
  • 51
  • Why are you running these commands from Git Bash? Why not just use the Windows command prompt? – Kevin Mar 27 '20 at 17:39
  • Because that is the way our build environment works. – JB_User Mar 27 '20 at 17:44
  • 1
    I'm not sure MSBuild.exe was intended to run in the altered environment provided by Git Bash. You likely need to reset some of your environment in Git Bash *back* to what the native Windows environment provides. Perhaps, something like this [answer](https://stackoverflow.com/a/43409598/3987854). – Kevin Mar 27 '20 at 17:51
  • The same problem occurs if I do this in a Windows command prompt. So, this is not related to Git Bash in anyway. – JB_User Mar 27 '20 at 19:06
  • I can figure this out if I could just read the text in the MSBuild windows that pops up for a fraction of a second. There must be a way to either capture that text, or make the window stay up, or something. How can I read the MSBuild output? – JB_User Mar 27 '20 at 19:31
  • You have googled for the error message, haven't you? Have you checked that question and its answers? https://stackoverflow.com/questions/44478492/cmake-failed-to-run-msbuild-command-msbuild-exe – Tsyvarev Mar 27 '20 at 20:22
  • Yes, I have searched for this extensively. The link you posted is not relevant to me. In his case, he simply needed to add the location of MSBuild to his path. In my case, I'm already using the full path. – JB_User Mar 28 '20 at 15:28
  • Try a newer version of cmake. I did that once, and it solved everything. – C.J. Mar 31 '20 at 03:57

0 Answers0