c++ - ''没有这样的文件或目录' 'cmake' 从源代码为 C++ 中的 libssh 0.8.2 生成成功后?
问题描述
我有 libssh 0.8.2 和 cmake 3.12.2。
通过使用 cmake 中的 generate 选项成功完成构建。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++ - 如何在 OpenCV 中将图像与另一个图像相关联
- dataframe - 优化 PowerBI 查询以创建“迄今为止”最大值
- python - 在列表中的三个数字后添加换行符
- php - WooCommerce - 限制购物车页面上的邮政编码字符限制(不是结帐/帐户页面)
- laravel - 如何修复无法在 Amazon EC2 上连接的 Selenium?
- linux - 当一次就足够了,为什么 cat 调用 read() 两次?
- python - 为什么在密码检查中使用 time.sleep 和 random.expovariate?
- javascript - Object.assign(...as) 更改输入参数
- spring - Spring JPA 关系
- sql - Oracle 中的性能问题(公用表表达式和全局临时表之间的差异)