cmake: test for CMP0051 instead of version check We can use policy checks to see if a policy exists in cmake, like CMP0051, instead of relying on the version.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d5ad9d..e4d5f4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@
PROJECT(libgit2 C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
CMAKE_POLICY(SET CMP0015 NEW)
-IF (NOT CMAKE_VERSION VERSION_LESS 3.1)
+IF (POLICY CMP0051)
CMAKE_POLICY(SET CMP0051 NEW)
ENDIF()