# Find Nettle
#
IF(ENABLE_NETTLE)
- CHECK_LIBRARY_EXISTS(nettle "nettle_sha1_digest" "" NETTLE_FOUND)
+ FIND_PACKAGE(Nettle)
IF(NETTLE_FOUND)
- CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
- SET(CMAKE_REQUIRED_LIBRARIES "nettle")
- FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle)
- LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARY})
- CMAKE_POP_CHECK_STATE() # Restore the state of the variables
- ELSE(NETTLE_FOUND)
- SET(ENABLE_NETTLE OFF)
+ SET(HAVE_LIBNETTLE 1)
+ SET(HAVE_NETTLE_MD5_H 1)
+ SET(HAVE_NETTLE_RIPEMD160_H 1)
+ SET(HAVE_NETTLE_SHA_H 1)
+ INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR})
+ LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES})
ENDIF(NETTLE_FOUND)
+ MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR)
+ MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES)
ENDIF(ENABLE_NETTLE)
#
--- /dev/null
+# - Find Nettle\r
+# Find the Nettle include directory and library\r
+#\r
+# NETTLE_INCLUDE_DIR - where to find <nettle/sha.h>, etc.\r
+# NETTLE_LIBRARIES - List of libraries when using libnettle.\r
+# NETTLE_FOUND - True if libnettle found.\r
+\r
+IF (NETTLE_INCLUDE_DIR)\r
+ # Already in cache, be silent\r
+ SET(NETTLE_FIND_QUIETLY TRUE)\r
+ENDIF (NETTLE_INCLUDE_DIR)\r
+\r
+FIND_PATH(NETTLE_INCLUDE_DIR nettle/md5.h nettle/ripemd160.h nettle/sha.h)\r
+FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle libnettle)\r
+\r
+# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE if \r
+# all listed variables are TRUE\r
+INCLUDE(FindPackageHandleStandardArgs)\r
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETTLE DEFAULT_MSG NETTLE_LIBRARY NETTLE_INCLUDE_DIR)\r
+\r
+IF(NETTLE_FOUND)\r
+ SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY})\r
+ENDIF(NETTLE_FOUND)\r
/* Define to 1 if you have the `lzo2' library (-llzo2). */
#cmakedefine HAVE_LIBLZO2 1
+/* Define to 1 if you have the `nettle' library (-lnettle). */
+#cmakedefine HAVE_LIBNETTLE 1
+
/* Define to 1 if you have the `pcre' library (-lpcre). */
#cmakedefine HAVE_LIBPCRE 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#cmakedefine HAVE_NDIR_H 1
+/* Define to 1 if you have the <nettle/md5.h> header file. */
+#cmakedefine HAVE_NETTLE_MD5_H 1
+
+/* Define to 1 if you have the <nettle/ripemd160.h> header file. */
+#cmakedefine HAVE_NETTLE_RIPEMD160_H 1
+
+/* Define to 1 if you have the <nettle/sha.h> header file. */
+#cmakedefine HAVE_NETTLE_SHA_H 1
+
/* Define to 1 if you have the `nl_langinfo' function. */
#cmakedefine HAVE_NL_LANGINFO 1