 +  -DOPENSSL_THREADS
 +  -D_REENTRANT
 +  )
-+if(WIN32 AND NOT CYGWIN)
++if(WIN32)
 +  add_definitions(
++    -DOPENSSL_SYS_WIN32
 +    -DWIN32_LEAN_AND_MEAN
-+    -D_CRT_SECURE_NO_WARNINGS
++    -DUNICODE -D_UNICODE
++    -D_CRT_SECURE_NO_DEPRECATE
 +    -D_WINSOCK_DEPRECATED_NO_WARNINGS
 +    )
 +endif()

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b1e91ac
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,56 @@
+cmake_minimum_required(VERSION 3.12)
+project(openssl)
+include(flags OPTIONAL)

+set(INSERT_WARNING
+  "/* WARNING: do not edit! */\n/* Generated by CMakeLists.txt from crypto/${conf_file}.cmake */"
+  )
+if(WIN32)
+  set(DSO_SCHEME_MACROS
+    DSO_NONE
+    )
+elseif(UNIX)
+  set(DSO_SCHEME_MACROS
+    DSO_DLFCN
+    HAVE_DLFCN_H
