1
1

Add an option to build a static library.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@285 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
Andreas Schneider 2009-03-25 15:01:33 +00:00
родитель cf89b6eb48
Коммит fae68cac8a
4 изменённых файлов: 48 добавлений и 11 удалений

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

@ -63,6 +63,6 @@ if (UNIX AND NOT WIN32)
add_executable(samplessh sample.c) add_executable(samplessh sample.c)
add_executable(samplesshd samplesshd.c) add_executable(samplesshd samplesshd.c)
target_link_libraries(samplessh ${LIBSSH_LIBRARY}) target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
target_link_libraries(samplesshd ${LIBSSH_LIBRARY}) target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
endif (UNIX AND NOT WIN32) endif (UNIX AND NOT WIN32)

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

@ -1 +1,2 @@
option(WITH_SSH1 "Build with SSH1 support" OFF) option(WITH_SSH1 "Build with SSH1 support" OFF)
option(WITH_STATIC_LIB "Build with a static library" OFF)

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

@ -57,7 +57,7 @@ echo "Usage: `basename $0` [--prefix /install_prefix|--build [debug|final]|--cle
cd ${BUILDDIR} cd ${BUILDDIR}
OPTIONS="--graphviz=${BUILDDIR}/libssh.dot -DUNIT_TESTING=ON" OPTIONS="--graphviz=${BUILDDIR}/libssh.dot -DUNIT_TESTING=ON -DWITH_STATIC_LIB=ON"
while test -n "$1"; do while test -n "$1"; do
PARAM="$1" PARAM="$1"

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

@ -12,13 +12,19 @@ set(LIBSSH_PRIVATE_INCLUDE_DIRS
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
) )
set(LIBSSH_LIBRARY set(LIBSSH_SHARED_LIBRARY
ssh ssh_shared
CACHE INTERNAL "libssh library" CACHE INTERNAL "libssh shared library"
) )
if (WITH_STATIC_LIB)
set(LIBSSH_STATIC_LIBRARY
ssh_static
CACHE INTERNAL "libssh static library"
)
endif (WITH_STATIC_LIB)
set(LIBSSH_LINK_LIBRARIES set(LIBSSH_LINK_LIBRARIES
${LIBSSH_LIBRARY}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
) )
@ -34,6 +40,7 @@ if (CRYPTO_LIBRARY)
${LIBSSH_PRIVATE_INCLUDE_DIRS} ${LIBSSH_PRIVATE_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS}
) )
set(LIBSSH_LINK_LIBRARIES set(LIBSSH_LINK_LIBRARIES
${LIBSSH_LINK_LIBRARIES} ${LIBSSH_LINK_LIBRARIES}
${CRYPTO_LIBRARY} ${CRYPTO_LIBRARY}
@ -45,6 +52,7 @@ if (GCRYPT_LIBRARY)
${LIBSSH_PRIVATE_INCLUDE_DIRS} ${LIBSSH_PRIVATE_INCLUDE_DIRS}
${GCRYPT_INCLUDE_DIRS} ${GCRYPT_INCLUDE_DIRS}
) )
set(LIBSSH_LINK_LIBRARIES set(LIBSSH_LINK_LIBRARIES
${LIBSSH_LINK_LIBRARIES} ${LIBSSH_LINK_LIBRARIES}
${GCRYPT_LIBRARY} ${GCRYPT_LIBRARY}
@ -95,25 +103,53 @@ include_directories(
${LIBSSH_PRIVATE_INCLUDE_DIRS} ${LIBSSH_PRIVATE_INCLUDE_DIRS}
) )
add_library(${LIBSSH_LIBRARY} SHARED ${libssh_SRCS}) add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS})
target_link_libraries(${LIBSSH_LINK_LIBRARIES}) target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
set_target_properties( set_target_properties(
${LIBSSH_LIBRARY} ${LIBSSH_SHARED_LIBRARY}
PROPERTIES PROPERTIES
VERSION VERSION
${LIBRARY_VERSION} ${LIBRARY_VERSION}
SOVERSION SOVERSION
${LIBRARY_SOVERSION} ${LIBRARY_SOVERSION}
OUTPUT_NAME
ssh
) )
install( install(
TARGETS TARGETS
${LIBSSH_LIBRARY} ${LIBSSH_SHARED_LIBRARY}
DESTINATION DESTINATION
${LIB_INSTALL_DIR} ${LIB_INSTALL_DIR}
COMPONENT COMPONENT
libraries libraries
) )
if (WITH_STATIC_LIB)
add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS})
target_link_libraries(${LIBSSH_STATIC_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
set_target_properties(
${LIBSSH_STATIC_LIBRARY}
PROPERTIES
VERSION
${LIBRARY_VERSION}
SOVERSION
${LIBRARY_SOVERSION}
OUTPUT_NAME
ssh
)
install(
TARGETS
${LIBSSH_STATIC_LIBRARY}
DESTINATION
${LIB_INSTALL_DIR}
COMPONENT
libraries
)
endif (WITH_STATIC_LIB)