From 92eeea4627e2fbf5b5b9e6a67789b7d3dabbfca2 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 3 Jul 2012 15:10:33 +0000 Subject: [PATCH] - Modified CMakeLists to support zlib --- CMakeLists.txt | 10 ++++++++++ programs/ssl/CMakeLists.txt | 4 ++++ programs/test/CMakeLists.txt | 4 ++++ programs/x509/CMakeLists.txt | 4 ++++ tests/CMakeLists.txt | 4 ++++ 5 files changed, 26 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 689d56301..bae87e3bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ endif(CMAKE_BUILD_TYPE STREQUAL "Coverage") option(USE_PKCS11_HELPER_LIBRARY "Build PolarSSL with the pkcs11-helper library." OFF) +option(ENABLE_ZLIB_SUPPORT "Build PolarSSL with zlib library." OFF) + if(LIB_INSTALL_DIR) else() set(LIB_INSTALL_DIR lib) @@ -24,6 +26,14 @@ endif() include_directories(include/) +if(ENABLE_ZLIB_SUPPORT) + find_package(ZLIB) + + if(ZLIB_FOUND) + include_directories(ZLIB_INCLUDE_DIR) + endif(ZLIB_FOUND) +endif(ENABLE_ZLIB_SUPPORT) + add_subdirectory(library) add_subdirectory(include) diff --git a/programs/ssl/CMakeLists.txt b/programs/ssl/CMakeLists.txt index 4dcf01cef..1986b0849 100644 --- a/programs/ssl/CMakeLists.txt +++ b/programs/ssl/CMakeLists.txt @@ -6,6 +6,10 @@ if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) +if(ENABLE_ZLIB_SUPPORT) + set(libs ${libs} ${ZLIB_LIBRARIES}) +endif(ENABLE_ZLIB_SUPPORT) + add_executable(ssl_client1 ssl_client1.c) target_link_libraries(ssl_client1 ${libs}) diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt index f00fc9d60..c05b903f4 100644 --- a/programs/test/CMakeLists.txt +++ b/programs/test/CMakeLists.txt @@ -8,6 +8,10 @@ if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) +if(ENABLE_ZLIB_SUPPORT) + set(libs ${libs} ${ZLIB_LIBRARIES}) +endif(ENABLE_ZLIB_SUPPORT) + add_executable(selftest selftest.c) target_link_libraries(selftest ${libs}) diff --git a/programs/x509/CMakeLists.txt b/programs/x509/CMakeLists.txt index 554d9a053..08a962aef 100644 --- a/programs/x509/CMakeLists.txt +++ b/programs/x509/CMakeLists.txt @@ -6,6 +6,10 @@ if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) +if(ENABLE_ZLIB_SUPPORT) + set(libs ${libs} ${ZLIB_LIBRARIES}) +endif(ENABLE_ZLIB_SUPPORT) + add_executable(cert_app cert_app.c) target_link_libraries(cert_app ${libs}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 494fd2b19..3ff4f0b40 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,10 @@ if(USE_PKCS11_HELPER_LIBRARY) set(libs ${libs} pkcs11-helper) endif(USE_PKCS11_HELPER_LIBRARY) +if(ENABLE_ZLIB_SUPPORT) + set(libs ${libs} ${ZLIB_LIBRARIES}) +endif(ENABLE_ZLIB_SUPPORT) + function(add_test_suite suite_name) if(ARGV1) set(data_name ${ARGV1})