CMake compiled VS project and encountered an error when installing: error MSB3073: Command "setlocal
Error message
70>CMake Error at src/base/cmake_install.cmake:63 (file):
70> file INSTALL cannot find
70> "E:/Projs/algs/colmap/colmap_build/src/base/Release/camera_rig_test.exe".
70>Call Stack (most recent call first):
70> src/cmake_install.cmake:61 (include)
70> cmake_install.cmake:65 (include)
70>
70>
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: Command "setlocal
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: "D:\Pros\IDE\IDE Tools\ cmake-3.15.0-rc1-win64-x64\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmEnd
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto : cmDone
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmErrorLevel
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: exit /b %1
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmDone
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
70>C:\Program\Dev\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" exited with code 1.
Solution 1
There are two ways to solve this problem according to the cause:
(1) Since CMAKE_INSTALL_PREFIX is specified as the C drive directory in the CMake GUI, the install requires permission when compiling and generating. At this point, you need to run Vs as an administrator.
(2) The reason why the set build directory is incorrect during cmake. For example, a new build directory is created outside the main directory of the source code (the directory where CMakelist.txt is located). Instead of creating this build directory in the correct home directory.
should not
Solution 2
If solution 1 cannot solve your problem, you can consider setting the VS project to the Release model, and then run the install.
Practice has proved that to solution 2, it can basically solve all the situations I have encountered.
0 Comments