c++ - ''No such file or directory' 'cmake' 在 c++ 中从源代码生成 libssh 0.8.2 成功后?

标签 c++ visual-c++ ssh cmake libssh

我有 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/

相关文章:

c++ - 如何在 C++ 中计算函数的执行时间和 cpu 加速

c++ - 稳定的时钟在系统范围内稳定吗?

c++ - 了解此代码中的 “Callable”对象/事物

c++ - 为什么链接器报告全局函数的多重定义符号而不是类静态方法

PHP SFTP/SSH 传输

c++ - 诊断多重定义错误

c++ - 正确增加指针?

windows - msi.h 在 dll 中给出编译错误

git - 为不在 Git Bash 中的 git 配置 SSH key

php - Composer :在phpseclib SSH2中找不到命令