fix memory leak
[umurmur.git] / CMakeLists.txt
index 7ff95a019e777695b7bd49f50a8d33234cdc593f..c59f76dee518659bad58d260636d1ba0eed93cea 100644 (file)
@@ -8,6 +8,8 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
 option(USE_POLARSSL_TESTCERT "Link to the PolarSSL test certificate and key." OFF)
 option(USE_POLARSSL_HAVEGE "Use the PolarSSL HAVEGE random generator key." OFF)
 
+option(USE_SHAREDMEMORY_API "Compile with Sharedmemory API support" OFF)
+
 if(USE_POLARSSL_TESTCERT OR USE_POLARSSL_HAVEGE)
   if(SSL MATCHES "openssl" OR SSL MATCHES "gnutls")
     message(FATAL_ERROR "Selecting USE_POLARSSL_TESTCERT or USE_POLARSSL_HAVEGE implies SSL=polarssl")
@@ -41,10 +43,15 @@ elseif("${SSL}" STREQUAL "polarssl")
 elseif("${SSL}" STREQUAL "gnutls")
   find_package(GnuTLS REQUIRED)
   if(GNUTLS_FOUND)
+    set(USE_GNUTLS ON)
     set(SSLIMP_LIBRARIES ${GNUTLS_LIBRARIES})
     set(SSLIMP_INCLUDE_DIR ${GNUTLS_INCLUDE_DIR})
     set(SSLIMP_LIBRARY_DIR ${GNUTLS_LIB_DIR})
   endif(GNUTLS_FOUND)
+  find_package(Nettle REQUIRED)
+  if(NETTLE_FOUND)
+    set(CRYPTO_LIBRARIES "${NETTLE_LIBRARIES}")
+  endif(NETTLE_FOUND)
 endif("${SSL}" STREQUAL "openssl")
 
 check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
@@ -54,7 +61,7 @@ if(NOT HAVE_CLOCK_GETTIME_RT)
   if(NOT HAVE_CLOCK_GETTIME)
     check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
     if(NOT HAVE_CLOCK_GET_TIME)
-      message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
+      message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time()!")
     endif()
   endif()
 else()
@@ -78,4 +85,5 @@ if(NOT OLD_CONFIG_FILE)
 endif(NOT OLD_CONFIG_FILE)
 
 add_definitions(${SSLIMP_CFLAGS})
-target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT})
+
+target_link_libraries(umurmurd ${LIBCONFIG_LIBRARIES} ${PROTOBUFC_LIBRARIES} ${SSLIMP_LIBRARIES} ${LIBRT} ${CRYPTO_LIBRARIES})