From a7d354a72d22cde4de1494bf3475d8ea49e9cd2d Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 15 3月 2020 11:00:39 +0800
Subject: [PATCH] fix compilation errors

---
 CMakeLists.txt |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f464593..7159721 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@
 		endif()
 	endif(THREADS_HAVE_PTHREAD_ARG)
 
-	#Zlib required when openssl version < 1.0.1f (centos 7)
+	#Zlib required with old openssl version < 1.0.1f in centos 7
 	IF(OPENSSL_VERSION VERSION_LESS_EQUAL 1.0.2)
 		SET ( ZLIB_USE_STATIC_LIBS ON ) 
 		find_package(ZLIB REQUIRED)
@@ -90,16 +90,12 @@
 			string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
 			SET(Boost_USE_STATIC_RUNTIME ON)
 		endif(${STATIC_RUNTIME})
-	
 		add_definitions("/D _CRT_SECURE_NO_WARNINGS")
+	    list(APPEND EXTERNAL_LIBS "bcrypt" "crypt32" "ws2_32" "iphlpapi")
 	else(MSVC)
-	    if(MINGW)
-	        list(APPEND EXTERNAL_LIBS "-lcrypt32 -lbcrypt -lws2_32 -liphlpapi")
-	        SET(CMAKE_EXE_LINKER_FLAGS "-static")
-	        #super ugly bug when cross compiling in cmake 3.16
-	        #IF(CMAKE_CROSSCOMPILING)
-			#	link_directories(BEFORE /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32)
-			#ENDIF()
+	    if(MINGW)        
+            list(APPEND EXTERNAL_LIBS "-lbcrypt" "-lcrypt32" "-lws2_32" "-liphlpapi")
+	        SET(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++")
 	    endif(MINGW)
 	endif(MSVC)
 	set(main_lib_dest "${PROJECT_NAME}")  

--
Gitblit v1.9.1