问题
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?
回答1:
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.
回答2:
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.
回答3:
Whenever cmake
cannot find Visual Studio components, it is because the build options that cmake
is using specifies versions that you don't have installed. Thus, either change the cmake
options or install the required Visual Studio version (14.0=2015, 15.0=2017, 16.0=2019) with the required components (usually Visual C++ components and Windows SDK components).
来源:https://stackoverflow.com/questions/45893623/cmake-failed-to-run-msbuild-exe-command-error