1
1
If you want to link against the static library you have to define
LIBSSH_STATIC and link against ssh_static.

gcc -static -DLIBSSH_STATIC -lssh_static foo.c -o foo
Этот коммит содержится в:
Andreas Schneider 2009-08-11 18:16:43 +02:00
родитель bfc6c7e606
Коммит db284d60b9
2 изменённых файлов: 24 добавлений и 24 удалений

Просмотреть файл

@ -22,25 +22,29 @@
#ifndef _LIBSSH_H #ifndef _LIBSSH_H
#define _LIBSSH_H #define _LIBSSH_H
#if defined _WIN32 || defined __CYGWIN__ #ifdef LIBSSH_STATIC
#ifdef SSH_EXPORTS #define LIBSSH_API
#ifdef __GNUC__
#define LIBSSH_API __attribute__((dllexport))
#else
#define LIBSSH_API __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define LIBSSH_API __attribute__((dllimport))
#else
#define LIBSSH_API __declspec(dllimport)
#endif
#endif
#else #else
#if __GNUC__ >= 4 #if defined _WIN32 || defined __CYGWIN__
#define LIBSSH_API __attribute__((visibility("default"))) #ifdef LIBSSH_EXPORTS
#ifdef __GNUC__
#define LIBSSH_API __attribute__((dllexport))
#else
#define LIBSSH_API __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define LIBSSH_API __attribute__((dllimport))
#else
#define LIBSSH_API __declspec(dllimport)
#endif
#endif
#else #else
#define LIBSSH_API #if __GNUC__ >= 4
#define LIBSSH_API __attribute__((visibility("default")))
#else
#define LIBSSH_API
#endif
#endif #endif
#endif #endif

Просмотреть файл

@ -156,10 +156,8 @@ set_target_properties(
${LIBRARY_SOVERSION} ${LIBRARY_SOVERSION}
OUTPUT_NAME OUTPUT_NAME
ssh ssh
CLEAN_DIRECT_OUTPUT
1
DEFINE_SYMBOL DEFINE_SYMBOL
SSH_EXPORTS LIBSSH_EXPORTS
COMPILE_FLAGS COMPILE_FLAGS
${LIBSSH_SHARED_CFLAGS} ${LIBSSH_SHARED_CFLAGS}
) )
@ -183,10 +181,8 @@ if (WITH_STATIC_LIB)
${LIBRARY_VERSION} ${LIBRARY_VERSION}
SOVERSION SOVERSION
${LIBRARY_SOVERSION} ${LIBRARY_SOVERSION}
OUTPUT_NAME COMPILE_FLAGS
ssh "-DLIBSSH_STATIC"
CLEAN_DIRECT_OUTPUT
1
) )
install( install(