aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--DefineOptions.cmake1
-rwxr-xr-xbuild/build_make.sh2
-rw-r--r--libssh/CMakeLists.txt52
4 files changed, 48 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46fd3aa7..36587c5a 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 44635741..3b5eb1b5 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 04a310af..f9e7508c 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 91ee3ccb..9c78d0d7 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)
+