Commit 3956679c13a5005db128c52ce56eb1b4ced4df82

Patrick Steinhardt 2020-04-03T20:08:02

cmake: remove policies The `CMAKE_MINIUM_REQUIRE()` function not only sets up the minimum required CMake version of a project, but it will also at the same time set the CMake policy version. In effect this means that all policies that have been introduced before the minimum CMake version will be enabled automatically. When updating our minimum required version ebabb88f2 (cmake: update minimum CMake version to v3.5.1, 2019-10-10), we didn't remove any of the policies we've been manually enabling. The newest CMake policy we've been enabling is CMP0054, which was introduced back in CMake v3.1. As a result, we can now just remove all manual calls to `CMAKE_POLICY()`.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d232f4..9b3f7cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,18 +11,9 @@
 # Install:
 # > cmake --build . --target install
 
-PROJECT(libgit2 C)
 CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
-CMAKE_POLICY(SET CMP0015 NEW)
-IF(POLICY CMP0051)
-	CMAKE_POLICY(SET CMP0051 NEW)
-ENDIF()
-IF(POLICY CMP0042)
-	CMAKE_POLICY(SET CMP0042 NEW)
-ENDIF()
-IF(POLICY CMP0054)
-	CMAKE_POLICY(SET CMP0054 NEW)
-ENDIF()
+
+project(libgit2 C)
 
 # Add find modules to the path
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/")