summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2017-09-06 22:01:50 +0000
committerEtienne Samson <samson.etienne@gmail.com>2017-10-23 20:02:35 +0200
commit99d6ebb33375369f8a033938fab984f89832ba82 (patch)
treec0c061b1425a24f8e4a86f361c62fdceb327ef23 /cmake/Modules
parent152f3766eed6ad26e62eb614de22c9f5a50110b5 (diff)
downloadlibgit2-99d6ebb33375369f8a033938fab984f89832ba82.tar.gz
cmake: make our macOS helpers more CMake-y
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindCoreFoundation.cmake31
-rw-r--r--cmake/Modules/FindSecurity.cmake33
2 files changed, 50 insertions, 14 deletions
diff --git a/cmake/Modules/FindCoreFoundation.cmake b/cmake/Modules/FindCoreFoundation.cmake
index ef88694ee..e86ccbf03 100644
--- a/cmake/Modules/FindCoreFoundation.cmake
+++ b/cmake/Modules/FindCoreFoundation.cmake
@@ -1,9 +1,26 @@
-IF (COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_DIRS)
+# Find CoreFoundation.framework
+# This will define :
+#
+# COREFOUNDATION_FOUND
+# COREFOUNDATION_LIBRARIES
+# COREFOUNDATION_LDFLAGS
+#
+
+FIND_PATH(COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h)
+FIND_LIBRARY(COREFOUNDATION_LIBRARIES NAMES CoreFoundation)
+IF (COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES)
+ IF (NOT CoreFoundation_FIND_QUIETLY)
+ MESSAGE("-- Found CoreFoundation ${COREFOUNDATION_LIBRARIES}")
+ ENDIF()
SET(COREFOUNDATION_FOUND TRUE)
-ELSE ()
- FIND_PATH(COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h)
- FIND_LIBRARY(COREFOUNDATION_DIRS NAMES CoreFoundation)
- IF (COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_DIRS)
- SET(COREFOUNDATION_FOUND TRUE)
- ENDIF ()
+ SET(COREFOUNDATION_LDFLAGS "-framework CoreFoundation")
ENDIF ()
+
+IF (CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND)
+ MESSAGE(FATAL "-- CoreFoundation not found")
+ENDIF()
+
+MARK_AS_ADVANCED(
+ COREFOUNDATION_INCLUDE_DIR
+ COREFOUNDATION_LIBRARIES
+)
diff --git a/cmake/Modules/FindSecurity.cmake b/cmake/Modules/FindSecurity.cmake
index d6950e566..487f7e500 100644
--- a/cmake/Modules/FindSecurity.cmake
+++ b/cmake/Modules/FindSecurity.cmake
@@ -1,9 +1,28 @@
-IF (SECURITY_INCLUDE_DIR AND SECURITY_DIRS)
+# 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("-- Found Security ${SECURITY_LIBRARIES}")
+ ENDIF()
SET(SECURITY_FOUND TRUE)
-ELSE ()
- FIND_PATH(SECURITY_INCLUDE_DIR NAMES Security/Security.h)
- FIND_LIBRARY(SECURITY_DIRS NAMES Security)
- IF (SECURITY_INCLUDE_DIR AND SECURITY_DIRS)
- SET(SECURITY_FOUND TRUE)
- ENDIF ()
+ 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 "-- Security not found")
+ENDIF()
+
+MARK_AS_ADVANCED(
+ SECURITY_INCLUDE_DIR
+ SECURITY_LIBRARIES
+)