Search code examples
cnmakelibssh2libssh

Compiling libssh2 in Windows with NMake: Not producing a static library


I am trying to compile libssh2 under Windows with Visual Studio nmake. I am producing a shared library (DLL) but not producing a static library (LIB).

I've gone through hours of reading their documentation but have found no mention of generating the static library. Normally, I'd assume it would be generated alongside the DLL but that is not the case.

Command line looks like so:

nmake /f NMakefile

Solution

  • Figured it out. You have to create the build environment with CMake. Add your CMake bin directory to the environment PATH variable.

    With command prompt inside root libssh2:

    mkdir build
    cd build
    cmake -G "Visual Studio 14 2015 Win64" ..
    cmake --build .
    

    This will create a MDd static debug library.

    For a regular MD static release library, run:

    cmake --build . --config Release