From 25374b871e517303a67777c5c672a7eeced0f8eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matheus=20Catarino=20Fran=C3=A7a?=
 <matheus-catarino@hotmail.com>
Date: Sat, 12 Dec 2020 15:29:49 -0300
Subject: [PATCH] Windows dll - mingw
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Matheus Catarino França <matheus-catarino@hotmail.com>
---
 CMakeLists.txt     | 7 ++++++-
 src/expresscpp.cpp | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e5dfbb..cc0684b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,6 +80,10 @@ if(NOT BUILD_SHARED_LIBS)
   set(BUILD_SHARED_LIBS OFF)
 endif()
 
+if(WIN32)
+ link_libraries(ws2_32 mswsock Bcrypt)
+endif()
+
 if(EXPRESSCPP_ENABLE_COVERAGE)
   if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
     message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
@@ -288,7 +292,8 @@ set(EXPRESSCPP_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
 install(TARGETS ${PROJECT_NAME}
         EXPORT ${PROJECT_NAME}Targets
         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib
-        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT lib)
 
 install(EXPORT ${PROJECT_NAME}Targets
         DESTINATION ${EXPRESSCPP_CONFIG_INSTALL_DIR}
diff --git a/src/expresscpp.cpp b/src/expresscpp.cpp
index 985f71d..9232ff9 100644
--- a/src/expresscpp.cpp
+++ b/src/expresscpp.cpp
@@ -147,7 +147,7 @@ void ExpressCpp::HandleRequest(request_t req, response_t res, std::function<void
     auto eptr = std::current_exception();
     if (error_handler_registered_) {
       expresscpp::NextRouter next;
-      auto ec = std::make_error_code(std::errc::no_message);
+      auto ec = std::make_error_code(std::errc::bad_message);
       error_handler_(ec, req, res, next);
     } else {
       std::rethrow_exception(eptr);
-- 
2.29.2

