diff -Naur snappy-1.2.2-orig/CMakeLists.txt snappy-1.2.2/CMakeLists.txt
--- snappy-1.2.2-orig/CMakeLists.txt	2025-05-25 21:38:20.499819700 +0300
+++ snappy-1.2.2/CMakeLists.txt	2025-05-25 21:44:48.317029200 +0300
@@ -251,6 +251,11 @@
   "snappy-stubs-public.h.in"
   "${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
 
+if (BUILD_SHARED_LIBS)
+  set (target_suffix "shared")
+else ()
+  set (target_suffix "static")
+endif ()
 add_library(snappy "")
 target_sources(snappy
   PRIVATE
@@ -432,6 +437,7 @@
     EXPORT SnappyTargets
     NAMESPACE Snappy::
     DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
+    FILE ${PROJECT_NAME}-${target_suffix}-targets.cmake
   )
   install(
     FILES
diff -Naur snappy-1.2.2-orig/cmake/SnappyConfig.cmake.in snappy-1.2.2/cmake/SnappyConfig.cmake.in
--- snappy-1.2.2-orig/cmake/SnappyConfig.cmake.in	2025-03-26 18:19:22.000000000 +0300
+++ snappy-1.2.2/cmake/SnappyConfig.cmake.in	2025-05-25 21:42:10.246765400 +0300
@@ -28,6 +28,61 @@
 
 @PACKAGE_INIT@
 
-include("${CMAKE_CURRENT_LIST_DIR}/SnappyTargets.cmake")
-
+set(@PROJECT_NAME@_known_comps static shared)
+set(@PROJECT_NAME@_comp_static NO)
+set(@PROJECT_NAME@_comp_shared NO)
+foreach (@PROJECT_NAME@_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
+    if (@PROJECT_NAME@_comp IN_LIST @PROJECT_NAME@_known_comps)
+        set(@PROJECT_NAME@_comp_${@PROJECT_NAME@_comp} YES)
+    else ()
+        set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+            "@PROJECT_NAME@ does not recognize component `${@PROJECT_NAME@_comp}`.")
+        set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+        return()
+    endif ()
+endforeach ()
+
+if (@PROJECT_NAME@_comp_static AND @PROJECT_NAME@_comp_shared)
+    set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+        "@PROJECT_NAME@ `static` and `shared` components are mutually exclusive.")
+    set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+    return()
+endif ()
+
+set(@PROJECT_NAME@_static_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-static-targets.cmake")
+set(@PROJECT_NAME@_shared_targets "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-shared-targets.cmake")
+
+macro(@PROJECT_NAME@_load_targets type)
+    if (NOT EXISTS "${@PROJECT_NAME@_${type}_targets}")
+        set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+            "@PROJECT_NAME@ `${type}` libraries were requested but not found.")
+        set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
+        return()
+    endif ()
+    include("${@PROJECT_NAME@_${type}_targets}")
+endmacro()
+
+if (@PROJECT_NAME@_comp_static)
+    @PROJECT_NAME@_load_targets(static)
+elseif (@PROJECT_NAME@_comp_shared)
+    @PROJECT_NAME@_load_targets(shared)
+elseif (DEFINED @PROJECT_NAME@_SHARED_LIBS AND @PROJECT_NAME@_SHARED_LIBS)
+    @PROJECT_NAME@_load_targets(shared)
+elseif (DEFINED @PROJECT_NAME@_SHARED_LIBS AND NOT @PROJECT_NAME@_SHARED_LIBS)
+    @PROJECT_NAME@_load_targets(static)
+elseif (BUILD_SHARED_LIBS)
+    if (EXISTS "${@PROJECT_NAME@_shared_targets}")
+        @PROJECT_NAME@_load_targets(shared)
+    else ()
+        @PROJECT_NAME@_load_targets(static)
+    endif ()
+else ()
+    if (EXISTS "${@PROJECT_NAME@_static_targets}")
+        @PROJECT_NAME@_load_targets(static)
+    else ()
+        @PROJECT_NAME@_load_targets(shared)
+    endif ()
+endif ()
+
+
 check_required_components(Snappy)
\ No newline at end of file
