aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/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 /tests/unittests/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 'tests/unittests/CMakeLists.txt')
-rw-r--r--tests/unittests/CMakeLists.txt5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt
index d518dd21..e833481a 100644
--- a/tests/unittests/CMakeLists.txt
+++ b/tests/unittests/CMakeLists.txt
@@ -32,11 +32,12 @@ if (UNIX AND NOT WIN32)
# requires /dev/null
add_cmocka_test(torture_channel torture_channel.c ${TORTURE_LIBRARY})
# requires pthread
- if (LIBSSH_THREADS)
+ if (CMAKE_USE_PTHREADS_INIT)
add_cmocka_test(torture_rand torture_rand.c ${TORTURE_LIBRARY})
+ target_link_libraries(torture_rand Threads::Threads)
# Not working correctly
#if (WITH_SERVER)
# add_cmocka_test(torture_server_x11 torture_server_x11.c ${TORTURE_LIBRARY})
#endif (WITH_SERVER)
- endif (LIBSSH_THREADS)
+ endif ()
endif (UNIX AND NOT WIN32)