 diff --git a/CMakeLists.txt b/CMakeLists.txt
 new file mode 100644
-index 0000000..fdfebc6
+index 0000000..dbfa40b
 --- /dev/null
 +++ b/CMakeLists.txt
 @@ -0,0 +1,69 @@
-+cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.12)
 +project(libstrophe)
 +include(flags OPTIONAL)
 +enable_testing()

+  )
+foreach(exe ${examples})
+  add_executable(${exe} ${exe}.c)
+  target_link_libraries(${exe} libstrophe)
+  set_property(TARGET ${exe} PROPERTY FOLDER examples)
+endforeach()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..c540b0a
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,71 @@
+set(lib_name ${PROJECT_NAME})
+########################################
+# source
+set(${lib_name}_libsrcs
+  auth.c
+  common.h

+  ARCHIVE DESTINATION lib
+  )
+install(EXPORT ${targetsFile} DESTINATION lib/cmake)
diff --git a/src/tls_openssl.c b/src/tls_openssl.c
index 0e440c1..04f379e 100644
--- a/src/tls_openssl.c
+++ b/src/tls_openssl.c
@@ -49,8 +49,12 @@ static void _tls_log_error(xmpp_ctx_t *ctx);
 
 void tls_initialize(void)
 {
+#if OPENSSL_API_COMPAT < 0x10100000L
     SSL_library_init();
     SSL_load_error_strings();
+#else
+    OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
 }
 
 void tls_shutdown(void)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..dabc2ae
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,28 @@
+add_library(testlib STATIC test.c test.h)
+target_link_libraries(testlib PUBLIC libstrophe)
+set_property(TARGET testlib PROPERTY FOLDER tests)
+set(tests
+  check_parser
