diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-03-25 15:01:33 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-03-25 15:01:33 +0000 |
commit | fae68cac8a5ffd5a52257f2b62110d91a95d62ab (patch) | |
tree | 0eaa1d6d0099fb9c1527f6efb7b9d661237891c2 | |
parent | cf89b6eb48ea1d644b68cef53c2d7be46aaaa62f (diff) | |
download | libssh-fae68cac8a5ffd5a52257f2b62110d91a95d62ab.tar.gz libssh-fae68cac8a5ffd5a52257f2b62110d91a95d62ab.tar.xz libssh-fae68cac8a5ffd5a52257f2b62110d91a95d62ab.zip |
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
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | DefineOptions.cmake | 1 | ||||
-rwxr-xr-x | build/build_make.sh | 2 | ||||
-rw-r--r-- | libssh/CMakeLists.txt | 52 |
4 files changed, 48 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 46fd3aa..36587c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,6 @@ if (UNIX AND NOT WIN32) add_executable(samplessh sample.c) add_executable(samplesshd samplesshd.c) - target_link_libraries(samplessh ${LIBSSH_LIBRARY}) - target_link_libraries(samplesshd ${LIBSSH_LIBRARY}) + target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY}) + target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY}) endif (UNIX AND NOT WIN32) diff --git a/DefineOptions.cmake b/DefineOptions.cmake index 4463574..3b5eb1b 100644 --- a/DefineOptions.cmake +++ b/DefineOptions.cmake @@ -1 +1,2 @@ option(WITH_SSH1 "Build with SSH1 support" OFF) +option(WITH_STATIC_LIB "Build with a static library" OFF) diff --git a/build/build_make.sh b/build/build_make.sh index 04a310a..f9e7508 100755 --- a/build/build_make.sh +++ b/build/build_make.sh @@ -57,7 +57,7 @@ echo "Usage: `basename $0` [--prefix /install_prefix|--build [debug|final]|--cle 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 PARAM="$1" diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt index 91ee3cc..9c78d0d 100644 --- a/libssh/CMakeLists.txt +++ b/libssh/CMakeLists.txt @@ -12,13 +12,19 @@ set(LIBSSH_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ) -set(LIBSSH_LIBRARY - ssh - CACHE INTERNAL "libssh library" +set(LIBSSH_SHARED_LIBRARY + ssh_shared + 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 - ${LIBSSH_LIBRARY} ${ZLIB_LIBRARIES} ) @@ -34,6 +40,7 @@ if (CRYPTO_LIBRARY) ${LIBSSH_PRIVATE_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ) + set(LIBSSH_LINK_LIBRARIES ${LIBSSH_LINK_LIBRARIES} ${CRYPTO_LIBRARY} @@ -45,6 +52,7 @@ if (GCRYPT_LIBRARY) ${LIBSSH_PRIVATE_INCLUDE_DIRS} ${GCRYPT_INCLUDE_DIRS} ) + set(LIBSSH_LINK_LIBRARIES ${LIBSSH_LINK_LIBRARIES} ${GCRYPT_LIBRARY} @@ -95,25 +103,53 @@ include_directories( ${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( - ${LIBSSH_LIBRARY} + ${LIBSSH_SHARED_LIBRARY} PROPERTIES VERSION ${LIBRARY_VERSION} SOVERSION ${LIBRARY_SOVERSION} + OUTPUT_NAME + ssh ) install( TARGETS - ${LIBSSH_LIBRARY} + ${LIBSSH_SHARED_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} COMPONENT 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) + |