aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2018-07-02 13:03:12 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-03 16:43:03 +0200
commit83b43443e51b5db06184750fb874e1e8d7ece95a (patch)
tree9c81acc146ee9d0d129ab953a38e2363574fa888 /CMakeLists.txt
parent6a077fe7509fb3141c0c63365a32208e42aa90f1 (diff)
downloadlibssh-83b43443e51b5db06184750fb874e1e8d7ece95a.tar.gz
libssh-83b43443e51b5db06184750fb874e1e8d7ece95a.tar.xz
libssh-83b43443e51b5db06184750fb874e1e8d7ece95a.zip
threads: Automatically call ssh_init on load
This makes unnecessary to call ssh_init() when the library is dynamically loaded. Also removes the threads shared library. The used threads implementation is chosen in configuration time, changing the ssh_threads_get_default() depending on the available threads library. Internally, it is expected a threads implementation providing: - void ssh_mutex_lock(void **mutex); - void ssh_mutex_unlock(void **mutex); - struct ssh_threads_callbacks_struct *ssh_threads_get_default(void); and a crypto implementation providing: - int crypto_thread_init(struct ssh_threads_callbacks_struct *user_callbacks); - void crypto_thread_finalize(void); This adds internal threads implementation for pthreads and noop. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 1 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa0678de..c6223715 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,7 @@ endif(WITH_GCRYPT)
# Find out if we have threading available
set(CMAKE_THREAD_PREFER_PTHREADS ON)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if (WITH_GSSAPI)
@@ -101,30 +102,15 @@ configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
- ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc
DESTINATION
${LIB_INSTALL_DIR}/pkgconfig
COMPONENT
pkgconfig
)
-
- if (LIBSSH_THREADS)
- configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
- install(
- FILES
- ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
- ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc
- DESTINATION
- ${LIB_INSTALL_DIR}/pkgconfig
- COMPONENT
- pkgconfig
- )
- endif (LIBSSH_THREADS)
endif (UNIX)
# cmake config files
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
-set(LIBSSH_THREADS_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
configure_file(${PROJECT_NAME}-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
configure_file(${PROJECT_NAME}-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)