From 60ae840790232c52ea3f456881771edee02d35ac Mon Sep 17 00:00:00 2001
From: Maximilien Siavelis <maximilien.siavelis@simulease.com>
Date: 周五, 05 1月 2018 09:10:28 +0800
Subject: [PATCH] fix some compilation issues

---
 CMakeLists.txt |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e2703b..74964b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,8 +69,7 @@
   SET(HAVE_64BIT_SIZE_T 0)
 endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
 
-include(add_boost)
-add_boost(STATIC MODULES date_time test program_options system filesystem) 
+find_package(Boost 1.55.0 COMPONENTS date_time unit_test_framework program_options system filesystem)
 #set below in case of dynamic linking in debug.
 #set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
 add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
@@ -81,10 +80,19 @@
 	find_package(OpenSSL REQUIRED)
 	include_directories(${OPENSSL_INCLUDE_DIR})
 	list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
-	FIND_PACKAGE(Dbus REQUIRED)
-	include_directories(${DBUS_INCLUDE_DIR})
-	include_directories(${DBUS_ARCH_INCLUDE_DIR})
-	list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
+	MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION}")
+	
+	#Zlib required when openssl version < 1.0.1f
+	find_package(ZLIB REQUIRED)
+	list(APPEND EXTERNAL_LIBS ${ZLIB_LIBRARIES})
+	
+	if(USE_DBUS_IDENTIFIER)
+	    FIND_PACKAGE(Dbus REQUIRED)
+	    add_definitions(-DUSE_DBUS)
+	    include_directories(${DBUS_INCLUDE_DIR})
+	    include_directories(${DBUS_ARCH_INCLUDE_DIR})
+	    list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
+	endif(USE_DBUS_IDENTIFIER)    
 	list(APPEND EXTERNAL_LIBS dl)
 endif(NOT WIN32)
 
@@ -135,8 +143,6 @@
 add_subdirectory(test)
 
 #include(build/modules/CmakeDebugVariables.txt)
-
-message("")
 message( STATUS "C compiler: " ${CMAKE_C_COMPILER})
 message( STATUS "C compiler flags: " ${CMAKE_C_FLAGS})
 message( STATUS "CXX compiler: " ${CMAKE_CXX_COMPILER})

--
Gitblit v1.9.1