diff OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake @ 4368:781f53eee856

fix OpenSslConfigurationStatic-1.1.1.cmake to generate windows plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 12 Dec 2020 19:41:30 +0100
parents 304842a0d152
children d9473bd5ed43
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake	Thu Dec 10 18:36:57 2020 +0100
+++ b/OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-1.1.1.cmake	Sat Dec 12 19:41:30 2020 +0100
@@ -55,6 +55,29 @@
   if (Failure)
     message(FATAL_ERROR "Error while patching a file")
   endif()
+
+  file(RENAME
+    ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h
+    ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h)
+
+  # The following patch of "e_os2.h" prevents from building OpenSSL
+  # as a DLL under Windows. Otherwise, symbols have inconsistent
+  # linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably
+  # if building an Orthanc plugin such as PostgreSQL or MySQL).
+  file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h "
+#include \"e_os2_source.h\"
+#if defined(_WIN32)
+#  undef OPENSSL_EXPORT
+#  undef OPENSSL_IMPORT
+#  undef OPENSSL_EXTERN
+#  undef OPENSSL_GLOBAL
+#  define OPENSSL_EXPORT
+#  define OPENSSL_IMPORT
+#  define OPENSSL_EXTERN extern
+#  define OPENSSL_GLOBAL
+#endif
+")
+
 else()
   message("The patches for OpenSSL have already been applied")
 endif()