Howto compile libssh using MinGW
Windows
FIXME
Linux
Compile libssh for Windows using MinGW. First you need a toolchain file which should look like the following example:
# the name of the target operating system set(CMAKE_SYSTEM_NAME Windows) # which compilers to use for C and C++ set(CMAKE_C_COMPILER i386-mingw32msvc-gcc) set(CMAKE_CXX_COMPILER i386-mingw32msvc-g++) # here is the target environment located set(CMAKE_FIND_ROOT_PATH /opt/cross/i386-mingw32msvc/ /usr/i686-pc-mingw32/sys-root/mingw) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Save this file as toolchain-mingw32.cmake. Now run cmake with the following options:
cmake \ -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain-mingw32.cmake \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ -DWITH_STATIC_LIB=ON \ -DCMAKE_SKIP_RPATH=ON \ /path/to/libssh
