diff -Naur gflags-2.2.2-orig/CMakeLists.txt gflags-2.2.2/CMakeLists.txt
--- gflags-2.2.2-orig/CMakeLists.txt	2025-05-22 12:12:28.664979400 +0300
+++ gflags-2.2.2/CMakeLists.txt	2025-05-22 12:35:29.120054700 +0300
@@ -70,7 +70,7 @@
 ## - GFLAGS_INSTALL_SHARED_LIBS
 ## - GFLAGS_INSTALL_STATIC_LIBS
 
-cmake_minimum_required (VERSION 3.0.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
 
 if (POLICY CMP0042)
   cmake_policy (SET CMP0042 NEW)
@@ -413,7 +413,7 @@
 
 # ----------------------------------------------------------------------------
 # installation directories
-if (OS_WINDOWS)
+if (OS_WINDOWS AND NOT MINGW)
   set (RUNTIME_INSTALL_DIR "bin")
   set (LIBRARY_INSTALL_DIR "lib")
   set (INCLUDE_INSTALL_DIR "include")
diff -Naur gflags-2.2.2-orig/cmake/config.cmake.in gflags-2.2.2/cmake/config.cmake.in
--- gflags-2.2.2-orig/cmake/config.cmake.in	2018-11-12 00:21:00.000000000 +0300
+++ gflags-2.2.2/cmake/config.cmake.in	2025-05-22 12:31:22.976621300 +0300
@@ -78,7 +78,7 @@
     else ()
       set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
     endif ()
-  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
+  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
     set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
   else ()
     set (@PACKAGE_PREFIX@_NOTHREADS TRUE)
diff -Naur gflags-2.2.2-orig/test/config/CMakeLists.txt gflags-2.2.2/test/config/CMakeLists.txt
--- gflags-2.2.2-orig/test/config/CMakeLists.txt	2018-11-12 00:21:00.000000000 +0300
+++ gflags-2.2.2/test/config/CMakeLists.txt	2025-05-22 12:35:59.813232600 +0300
@@ -1,6 +1,6 @@
 ## gflags package configuration tests
 
-cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
 
 project (gflags_${TEST_NAME})
 
diff -Naur gflags-2.2.2-orig/test/nc/CMakeLists.txt gflags-2.2.2/test/nc/CMakeLists.txt
--- gflags-2.2.2-orig/test/nc/CMakeLists.txt	2018-11-12 00:21:00.000000000 +0300
+++ gflags-2.2.2/test/nc/CMakeLists.txt	2025-05-22 12:36:15.080362100 +0300
@@ -1,6 +1,6 @@
 ## gflags negative compilation tests
 
-cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
 
 if (NOT TEST_NAME)
   message (FATAL_ERROR "Missing TEST_NAME CMake flag")
