2

I have libssh 0.8.2 and cmake 3.12.2.

The build is done successfully by using generate option in cmake. There is no ssh.lib file generated after this process by cmake, but and some files (ALL_BUILd, INSTALL,ssh_shared,ZERO_CHECK) were generated.

Hence I clicked on the 'open project' option in cmake after successful generation of cmake. While compiling the files in visual studio c++, it is showing two errors No such file or directory and:

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 
GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • Welcome to Stack Overflow! Other users marked your question for low quality and need for improvement. I re-worded/formatted your input to make it easier to read/understand. Please review my changes to ensure they reflect your intentions. Feel free to drop me a comment in case you have further questions or feedback for me. – GhostCat Sep 11 '18 at 09:05
  • @vre I think C++ is devil's spawn, but hey: nice answer ;-) ... consider deleting your comment then ;) – GhostCat Sep 11 '18 at 10:52

1 Answers1

1

Are you still using the CMakeLists.txt from the libssh-0.8.2/src directory (as I suppose from your previous question)? That is wrong. You need to use the top level CMakeLists.txt from libssh-0.8.2 directory.

Every directory level of this project may contain a CMakeLists.txt. The one containing the project statement is probably the one you need to use. The generation of a Visual Studio solution file (.sln) can be done on the command line from the top level directory (libssh-0.8.2) by cmake . -Bbuilddir -G "Visual Studio 15 2017 Win64". According to the documentation in the INSTALL file you may need to add -DOPENSSL_ROOT_DIR=C:\Users\Sami\<install path here> and -DZLIB_ROOT_DIR=C:\Users\Sami\<install path here> to this call.

Later you can build from the command line with cmake --build builddir --target ALL_BUILD --config Release. After a successful build you can install the project with cmake --build builddir --target INSTALL --config Release.

vre
  • 6,041
  • 1
  • 25
  • 39
  • I followed the same way as you mentioned above , but its going to another error as 'Could not find OpenSSL, GCrypt or mbedTLS'. I have already installed OpenSSL –  Sep 11 '18 at 10:51
  • Try setting `OPENSSL_ROOT_DIR` to the directory where you installed OpenSSL. For further guidance see the `INSTALL` document in root directory of libssh. Sometimes you need to delete CMakeCache.txt for your changes to become effective. – vre Sep 11 '18 at 11:01
  • Perfect. Thanks for the feedback. – vre Sep 11 '18 at 13:20