summaryrefslogtreecommitdiffstats
path: root/cmake/FindSecurity.cmake
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmake/FindSecurity.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/cmake/FindSecurity.cmake b/cmake/FindSecurity.cmake
new file mode 100644
index 0000000..14a2e2d
--- /dev/null
+++ b/cmake/FindSecurity.cmake
@@ -0,0 +1,28 @@
+# Find Security.framework
+# This will define :
+#
+# SECURITY_FOUND
+# SECURITY_LIBRARIES
+# SECURITY_LDFLAGS
+# SECURITY_HAS_SSLCREATECONTEXT
+#
+
+find_path(SECURITY_INCLUDE_DIR NAMES Security/Security.h)
+find_library(SECURITY_LIBRARIES NAMES Security)
+if(SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES)
+ if(NOT Security_FIND_QUIETLY)
+ message(STATUS "Found Security ${SECURITY_LIBRARIES}")
+ endif()
+ set(SECURITY_FOUND TRUE)
+ set(SECURITY_LDFLAGS "-framework Security")
+ check_library_exists("${SECURITY_LIBRARIES}" SSLCreateContext "Security/SecureTransport.h" SECURITY_HAS_SSLCREATECONTEXT)
+endif()
+
+if(Security_FIND_REQUIRED AND NOT SECURITY_FOUND)
+ message(FATAL_ERROR "Security not found")
+endif()
+
+mark_as_advanced(
+ SECURITY_INCLUDE_DIR
+ SECURITY_LIBRARIES
+)