@@ -319,15 +319,22 @@ if(USE_STATIC_BOOST)
319
319
else (USE_STATIC_BOOST )
320
320
message (STATUS "Linking against boost dynamic libraries" )
321
321
endif (USE_STATIC_BOOST )
322
-
323
- FIND_PACKAGE (ZLIB )
324
- IF (ZLIB_FOUND )
325
- MESSAGE (STATUS "ZLIB libraries found at: ${ZLIB_LIBRARIES} " )
326
- MESSAGE (STATUS "ZLIB includes found at: ${ZLIB_INCLUDE_DIRS} " )
327
- INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS} )
328
- else ()
329
- MESSAGE (FATAL_ERROR "ZLIB not found on your system, see install.txt how to get them installed. (for example 'sudo apt-get install zlib1g-dev')" )
330
- ENDIF (ZLIB_FOUND )
322
+ include_directories (${Boost_INCLUDE_DIRS} )
323
+
324
+ option (USE_BUILTIN_ZLIB "Use builtin zlib library" NO )
325
+ if (USE_BUILTIN_ZLIB )
326
+ add_subdirectory (zlib )
327
+ include_directories (${ZLIB_INCLUDE_DIRS} )
328
+ else (USE_BUILTIN_ZLIB )
329
+ find_package (ZLIB REQUIRED )
330
+ if (ZLIB_FOUND )
331
+ MESSAGE (STATUS "ZLIB libraries found at: ${ZLIB_LIBRARIES} " )
332
+ MESSAGE (STATUS "ZLIB includes found at: ${ZLIB_INCLUDE_DIRS} " )
333
+ include_directories (${ZLIB_INCLUDE_DIRS} )
334
+ else ()
335
+ MESSAGE (FATAL_ERROR "ZLIB not found on your system, see install.txt how to get them installed. (for example 'sudo apt-get install zlib1g-dev')" )
336
+ endif (ZLIB_FOUND )
337
+ endif (USE_BUILTIN_ZLIB )
331
338
332
339
FIND_PACKAGE (CURL )
333
340
IF (CURL_FOUND )
@@ -357,31 +364,22 @@ ENDIF(LIBUSB_FOUND)
357
364
#
358
365
# Find MD5/RMD160/SHA library
359
366
#
360
- find_path (OPENSSL_INCLUDE_DIR openssl/ssl.h )
361
- find_library (OPENSSL_LIBRARY ssl )
367
+ find_package (OpenSSL )
362
368
if (NOT OPENSSL_INCLUDE_DIR )
363
369
message (SEND_ERROR "Failed to find openssl include files (ssl.h), no HTTPS support" )
364
370
endif ()
365
- if (NOT OPENSSL_LIBRARY )
371
+ if (NOT OPENSSL_FOUND )
366
372
message (SEND_ERROR "Failed to find the openssl library, no HTTPS support" )
373
+ find_library (MD_LIBRARY NAMES md )
374
+ if (MD_LIBRARY )
375
+ target_link_libraries (domoticz ${MD_LIBRARY} )
376
+ endif (MD_LIBRARY )
367
377
else ()
368
378
add_definitions (-DNS_ENABLE_SSL )
369
- target_link_libraries (domoticz ${OPENSSL_LIBRARY} )
379
+ include_directories (${OPENSSL_INCLUDE_DIR} )
380
+ target_link_libraries (domoticz ${OPENSSL_LIBRARIES} )
370
381
endif ()
371
382
372
- FIND_LIBRARY (CRYPTO_LIBRARY NAMES crypto )
373
- IF (CRYPTO_LIBRARY )
374
- MESSAGE (STATUS "Crypto library found at: ${CRYPTO_LIBRARY} " )
375
- target_link_libraries (domoticz ${CRYPTO_LIBRARY} )
376
- ELSE (CRYPTO_LIBRARY )
377
- IF (NOT OPENSSL_FOUND )
378
- FIND_LIBRARY (MD_LIBRARY NAMES md )
379
- IF (MD_LIBRARY )
380
- LIST (APPEND ADDITIONAL_LIBS ${MD_LIBRARY} )
381
- ENDIF (MD_LIBRARY )
382
- ENDIF (NOT OPENSSL_FOUND )
383
- ENDIF (CRYPTO_LIBRARY )
384
-
385
383
## support lua popen on Linux platforms
386
384
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
387
385
# SET(OperatingSystem "Linux")
0 commit comments