Ken,

When you added Openssl support to proton was there a specific reason you
detected it "by hand" rather than using cmake FindPackage? Also
HAVE_OPENSSL_H isn't used anywhere.

I attach attach a patch to neaten this up in case this wasn't deliberate
- I'll commit it Weds unless you want to do it first (or ignore it if
this was deliberate).

Rafi,

I'm not sure I like the idea of having pn_config.h file entirely for the
purpose of holding the proton version number. I suggest that instead
this gets moved into proton/version.h. So that any application that
needs the proton version can get it in an obvious place - there seems no
other reason for pn_config.h so it could be removed.

Thoughts, plaudits, criticisms...

Andrew
>From 4c2c2b9af578275aece106a62ca54d66864d9269 Mon Sep 17 00:00:00 2001
From: Andrew Stitcher <astitc...@apache.org>
Date: Thu, 27 Sep 2012 16:26:08 -0400
Subject: [PATCH] NO-JIRA: Change cmake to use FindPackage for OpenSSL rather
 than doing it by hand - also remove unnecessary define for
 OpenSSL

---
 proton-c/CMakeLists.txt |   13 ++++++-------
 proton-c/pn_config.h.in |    2 --
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index f41b7bd..0465465 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -11,14 +11,13 @@ set (LIBDIR ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "Library directory")
 set (INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
 set (PN_VERSION "${PN_VERSION_MAJOR}.${PN_VERSION_MINOR}")
 
-include(CheckIncludeFile)
-CHECK_INCLUDE_FILE(openssl/ssl.h HAVE_OPENSSL_H)
-
 # Set the default SSL/TLS implementation
-set(ssl_impl, NONE)
-if (HAVE_OPENSSL_H)
+find_package(OpenSSL)
+
+set(ssl_impl, none)
+if (OPENSSL_FOUND)
    set(ssl_impl openssl)
-endif(HAVE_OPENSSL_H)
+endif(OPENSSL_FOUND)
 set(SSL_IMPL ${ssl_impl} CACHE STRING "Library to use for SSL/TLS support. Valid values: 'none','openssl'")
 
 configure_file (
@@ -44,7 +43,7 @@ add_custom_command (
 # Link in openssl if present
 if (SSL_IMPL STREQUAL openssl)
   set (pn_driver_ssl_impl src/ssl/openssl.c)
-  set (SSL_LIB ssl crypto)
+  set (SSL_LIB ${OPENSSL_LIBRARIES})
 else (SSL_IMPL STREQUAL openssl)
   set (pn_driver_ssl_impl src/ssl/ssl_stub.c)
 endif (SSL_IMPL STREQUAL openssl)
diff --git a/proton-c/pn_config.h.in b/proton-c/pn_config.h.in
index e0dbfb3..bf93dd1 100644
--- a/proton-c/pn_config.h.in
+++ b/proton-c/pn_config.h.in
@@ -25,6 +25,4 @@
 #define PN_VERSION_MAJOR @PN_VERSION_MAJOR@
 #define PN_VERSION_MINOR @PN_VERSION_MINOR@
 
-#cmakedefine HAVE_OPENSSL_H 1
-
 #endif /* pn_config.h */
-- 
1.7.7.6

Reply via email to