]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use cmake module similar to FindLZMA.cmake to find Nettle include dir and library.
authorAndres Mejia <amejia004@gmail.com>
Sat, 2 Feb 2013 03:10:15 +0000 (22:10 -0500)
committerAndres Mejia <amejia004@gmail.com>
Sat, 2 Feb 2013 03:10:15 +0000 (22:10 -0500)
CMakeLists.txt
build/cmake/FindNettle.cmake [new file with mode: 0644]
build/cmake/config.h.in

index ac9186e99e2bfff8584856e5d20a93626a6b68f3..bba08c85a523764d89d5fc0a5945996cd73e4649 100644 (file)
@@ -514,16 +514,17 @@ LIBARCHIVE_CHECK_C_SOURCE_COMPILES(
 # 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)
 
 #
diff --git a/build/cmake/FindNettle.cmake b/build/cmake/FindNettle.cmake
new file mode 100644 (file)
index 0000000..54ec9f5
--- /dev/null
@@ -0,0 +1,23 @@
+# - 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
index 0631195d695d548556acf0f1a1f0f9add18f6e10..50faae5c106f68851174c8fefb89e347717bd0cc 100644 (file)
@@ -588,6 +588,9 @@ typedef uint64_t uintmax_t;
 /* 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
 
@@ -703,6 +706,15 @@ typedef uint64_t uintmax_t;
 /* 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