From 8acd0089c42c24bb7d37d8250e08867e0bd72a0f Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 01 12月 2019 13:44:00 +0800
Subject: [PATCH] fix centos

---
 CMakeLists.txt |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e24dcfb..acd00fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,18 +52,24 @@
 	add_definitions("/D _CRT_SECURE_NO_WARNINGS")
 else(MSVC)
     if(MINGW)
-        list(APPEND EXTERNAL_LIBS "-lcrypt32 -lws2_32 -liphlpapi")
+        list(APPEND EXTERNAL_LIBS "-lcrypt32 -lbcrypt -lws2_32 -liphlpapi")
         SET(CMAKE_EXE_LINKER_FLAGS "-static")
     endif(MINGW)
 endif(MSVC)
 
-if(UNIX) #this is true for all the linux systems but not for cross compiling "linux->windows"
-	#find a static version of openssl crypto library
-	SET ( OPENSSL_USE_STATIC_LIBS ON )
-	find_package(OpenSSL REQUIRED COMPONENTS Crypto)
+SET ( OPENSSL_USE_STATIC_LIBS ON )
+find_package(OpenSSL COMPONENTS Crypto)
+IF(OPENSSL_FOUND)
+	add_definitions(-DHAS_OPENSSL)
 	include_directories(${OPENSSL_INCLUDE_DIR})
-    #list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
 	MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION} ")
+ENDIF(OPENSSL_FOUND)
+
+if(UNIX) #this is true for all the linux systems but not for cross compiling "linux->windows"
+	IF(NOT OPENSSL_FOUND)
+		MESSAGE(SEND_ERROR "Openssl not found - required in Linux")
+	ENDIF(NOT OPENSSL_FOUND)
+	
     find_package(Threads)
 	if(THREADS_HAVE_PTHREAD_ARG)
   		list(APPEND EXTERNAL_LIBS "-pthread")
@@ -72,12 +78,10 @@
   			 list(APPEND EXTERNAL_LIBS "${CMAKE_THREAD_LIBS_INIT}")
 		endif()
 	endif(THREADS_HAVE_PTHREAD_ARG)
-	#Zlib required when openssl version < 1.0.1f
-	#SET ( ZLIB_USE_STATIC_LIBS ON )
-	#find_package(ZLIB REQUIRED)
-	#MESSAGE(STATUS "Found zlib version ${ZLIB_VERSION} ")
+	
 	find_program( MEMORYCHECK_COMMAND valgrind )
 	set( MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full" )
+	
 	if(USE_DBUS_IDENTIFIER)
 	    FIND_PACKAGE(Dbus REQUIRED)
 	    add_definitions(-DUSE_DBUS)
@@ -85,9 +89,6 @@
 	    include_directories(${DBUS_ARCH_INCLUDE_DIR})
 	    list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
 	endif(USE_DBUS_IDENTIFIER)    
-	#if(NOT MINGW)
- 	#	list(APPEND EXTERNAL_LIBS ${CMAKE_DL_LIBS}) 
-	#endif(NOT MINGW)
 endif(UNIX)
 
 #initialize project

--
Gitblit v1.9.1