aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2013-09-21 23:32:51 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2013-10-06 17:43:53 +0200
commitcdcc92e3443c863d033d95d213aee5f270db774b (patch)
tree054e07059f8c7c7f19b01f7ce17c60079f234087 /cmake/Modules
parent29b3a94032c5f62463c00ed7dc9b8e9dc4c2b3eb (diff)
downloadlibssh-cdcc92e3443c863d033d95d213aee5f270db774b.tar.gz
libssh-cdcc92e3443c863d033d95d213aee5f270db774b.tar.xz
libssh-cdcc92e3443c863d033d95d213aee5f270db774b.zip
Compile libssh with nacl if possible
Conflicts: DefineOptions.cmake
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindNaCl.cmake61
1 files changed, 61 insertions, 0 deletions
diff --git a/cmake/Modules/FindNaCl.cmake b/cmake/Modules/FindNaCl.cmake
new file mode 100644
index 00000000..fa9c4090
--- /dev/null
+++ b/cmake/Modules/FindNaCl.cmake
@@ -0,0 +1,61 @@
+# - Try to find NaCl
+# Once done this will define
+#
+# NACL_FOUND - system has NaCl
+# NACL_INCLUDE_DIRS - the NaCl include directory
+# NACL_LIBRARIES - Link these to use NaCl
+# NACL_DEFINITIONS - Compiler switches required for using NaCl
+#
+# Copyright (c) 2010 Andreas Schneider <asn@cynapses.org>
+# Copyright (c) 2013 Aris Adamantiadis <aris@badcode.be>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
+ # in cache already
+ set(NACL_FOUND TRUE)
+else (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
+
+ find_path(NACL_INCLUDE_DIR
+ NAMES
+ nacl/crypto_box_curve25519xsalsa20poly1305.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+ find_library(NACL_LIBRARY
+ NAMES
+ nacl
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ set(NACL_INCLUDE_DIRS
+ ${NACL_INCLUDE_DIR}
+ )
+
+ if (NACL_LIBRARY)
+ set(NACL_LIBRARIES
+ ${NACL_LIBRARIES}
+ ${NACL_LIBRARY}
+ )
+ endif (NACL_LIBRARY)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(NaCl DEFAULT_MSG NACL_LIBRARIES NACL_INCLUDE_DIRS)
+
+ # show the NACL_INCLUDE_DIRS and NACL_LIBRARIES variables only in the advanced view
+ mark_as_advanced(NACL_INCLUDE_DIRS NACL_LIBRARIES)
+
+endif (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
+