Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake "failed to run MSBUILD.exe" command error

When I want to create visual studio 15(2017) make files for opencv 3.3.0, it gives me this error message: error in configuration process, project files maybe invalid and these:

CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
  The OLD behavior for policy CMP0020 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:94 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Error at CMakeLists.txt:127 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

I use windows 10. What is the problem and how can I fix it?

like image 916
Hasani Avatar asked Aug 26 '17 08:08

Hasani


2 Answers

In CMake-gui: After you selected the source & binary folder and click "configure" it will ask you which version of the compiler to use. Make sure that you select the correct one

For example, if you have "Visual Studio 2015" installed and you select "Visual Studio 2017", you will run into the "Failed to run MSBuild command:" error.

If you did select the wrong one, either delete the binaries-folder or simply use another binaries-folder - and then click configure and select the correct compiler.

like image 98
kalmiya Avatar answered Sep 18 '22 12:09

kalmiya


Try installing a Windows SDK (Windows 10 SDK) and run CMake with administrator privileges. If this will not help please edit your question with full warnings and errors messages as in current one you have skipped most important part.

like image 41
Ekci Avatar answered Sep 21 '22 12:09

Ekci