我有 libssh 0.8.2 和 cmake 3.12.2。
通过使用 cmake 中的生成选项成功完成构建。 cmake 在这个过程之后没有生成 ssh.lib 文件,但是生成了一些文件(ALL_BUILd、INSTALL、ssh_shared、ZERO_CHECK)。
因此,在成功生成 cmake 后,我单击了 cmake 中的“打开项目”选项。在 Visual Studio C++ 中编译文件时,显示两个错误 No such file or directory
和:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command "setlocal
"C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. INSTALL C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 133
最佳答案
您还在使用 libssh-0.8.2/src
中的 CMakeLists.txt 吗?目录(正如我从你之前的问题中推测的那样)?那是错的。您需要使用顶级 CMakeLists.txt
来自 libssh-0.8.2
目录。
这个项目的每个目录级别都可能包含一个CMakeLists.txt
.包含 project
的那个语句可能是您需要使用的语句。 Visual Studio 解决方案文件 (.sln
) 的生成可以通过命令行从顶级目录 (libssh-0.8.2
) 通过 cmake . -Bbuilddir -G "Visual Studio 15 2017 Win64"
完成.根据 INSTALL 文件中的文档,您可能需要添加 -DOPENSSL_ROOT_DIR=C:\Users\Sami\<install path here>
和 -DZLIB_ROOT_DIR=C:\Users\Sami\<install path here>
到这个电话。
稍后您可以使用 cmake --build builddir --target ALL_BUILD --config Release
从命令行构建.成功构建后,您可以使用 cmake --build builddir --target INSTALL --config Release
安装项目.
关于c++ - ''No such file or directory' 'cmake' 在 c++ 中从源代码生成 libssh 0.8.2 成功后?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52271231/