From 9b1419d46b156c3c61d30e761ee3636431187cc0 Mon Sep 17 00:00:00 2001
From: Yegor Yefremov <yegorslists@googlemail.com>
Date: Tue, 1 Aug 2023 11:53:35 +0200
Subject: [PATCH] CMake: bump the minimal required version to 2.8.12

The older CMake versions are deprecated.

Remove support for CMake code compatible with CMake older than 2.8.8.

Also move cmake_minimum_required() command before the project()
command invocation.

Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
Upstream-Status: Backport [3861e7dc9e83f2f6ff4e1579cf3bbf63a6827105]
---
 CMakeLists.txt | 46 +++++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b0b87c..41ddf58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+
 # Project
 project(libftdi1 C)
 set(MAJOR_VERSION 1)
@@ -12,7 +14,6 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
    set(CMAKE_BUILD_TYPE     RelWithDebInfo)
 endif("${CMAKE_BUILD_TYPE}" STREQUAL "")
 set(CMAKE_COLOR_MAKEFILE ON)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
 
 add_definitions(-Wall)
 
@@ -202,30 +203,25 @@ set ( LIBFTDI_VERSION_MINOR ${MINOR_VERSION} )
 
 set ( LIBFTDI_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIBFTDI_CMAKE_CONFIG_DIR}/UseLibFTDI1.cmake )
 
-if(CMAKE_VERSION VERSION_LESS 2.8.8) 
-  configure_file ( cmake/LibFTDI1Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake @ONLY )
-  configure_file ( cmake/LibFTDI1ConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1ConfigVersion.cmake @ONLY )
-else ()
-  include(CMakePackageConfigHelpers)
-
-  configure_package_config_file (
-    cmake/LibFTDI1Config.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake
-    INSTALL_DESTINATION ${LIBFTDI_CMAKE_CONFIG_DIR}
-    PATH_VARS
-      LIBFTDI_USE_FILE
-      LIBFTDI_ROOT_DIR
-      LIBFTDI_INCLUDE_DIR
-      LIBFTDI_INCLUDE_DIRS
-      LIBFTDI_LIBRARY_DIRS
-    NO_CHECK_REQUIRED_COMPONENTS_MACRO
-  )
-  write_basic_package_version_file (
-    LibFTDI1ConfigVersion.cmake 
-    VERSION ${LIBFTDI_VERSION_STRING} 
-    COMPATIBILITY AnyNewerVersion
-  )
-endif ()
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file (
+  cmake/LibFTDI1Config.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake
+  INSTALL_DESTINATION ${LIBFTDI_CMAKE_CONFIG_DIR}
+  PATH_VARS
+    LIBFTDI_USE_FILE
+    LIBFTDI_ROOT_DIR
+    LIBFTDI_INCLUDE_DIR
+    LIBFTDI_INCLUDE_DIRS
+    LIBFTDI_LIBRARY_DIRS
+  NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+write_basic_package_version_file (
+  LibFTDI1ConfigVersion.cmake
+  VERSION ${LIBFTDI_VERSION_STRING}
+  COMPATIBILITY AnyNewerVersion
+)
 
 
 install ( FILES 
