$NetBSD: patch-CMakeLists.txt,v 1.1 2015/10/06 14:56:12 fhajny Exp $

Backport futimens/futimes fix from master.

https://github.com/ethomson/libgit2/commit/8649dfd8df4f0d840a64c1d6c5fc80b8e94a68d1

--- CMakeLists.txt.orig	2015-10-05 21:37:22.000000000 +0000
+++ CMakeLists.txt
@@ -19,6 +19,7 @@ CMAKE_POLICY(SET CMP0015 NEW)
 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
 
 INCLUDE(CheckLibraryExists)
+INCLUDE(CheckFunctionExists)
 INCLUDE(AddCFlagIfSupported)
 INCLUDE(FindPkgConfig)
 
@@ -430,6 +431,11 @@ ELSE ()
 	ADD_C_FLAG_IF_SUPPORTED(-Wno-unused-const-variable)
 	ADD_C_FLAG_IF_SUPPORTED(-Wno-unused-function)
 
+	CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
+	IF (HAVE_FUTIMENS)
+		ADD_DEFINITIONS(-DHAVE_FUTIMENS)
+	ENDIF ()
+
 	IF (APPLE) # Apple deprecated OpenSSL
 		ADD_C_FLAG_IF_SUPPORTED(-Wno-deprecated-declarations)
 	ENDIF()
