File make-knowhere-available-for-other-libraries.patch of Package knowhere

From 5186558a4cd337bb447d0b966de8482878bb4335 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.com>
Date: Wed, 31 Jul 2024 12:02:54 +0200
Subject: [PATCH] make knowhere available for other libraries

Signed-off-by: Christian Goll <cgoll@suse.com>
---
 CMakeLists.txt                 | 25 +++++++++++++++++++++++++
 cmake/knowhere-config.cmake.in |  4 ++++
 2 files changed, 29 insertions(+)
 create mode 100644 cmake/knowhere-config.cmake.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bfab18..14ad988 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,7 +212,32 @@ if(WITH_FAISS_TESTS)
   add_subdirectory(tests/faiss)
 endif()
 
+include(CMakePackageConfigHelpers)
+
 install(TARGETS knowhere
         DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
 install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/knowhere"
         DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
+
+configure_file(cmake/knowhere-config.cmake.in knowhere-config.cmake @ONLY)
+
+# No version defined for knowhere, yet
+#write_basic_package_version_file(
+#    knowhere-config-version.cmake
+#    COMPATIBILITY SameMinorVersion
+#)
+
+set(
+    KNOWHERE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/knowhere"
+    CACHE STRING "CMake package config location relative to the install prefix"
+)
+mark_as_advanced(KNOWHERE_INSTALL_CMAKEDIR)
+
+install(
+    FILES
+    "${PROJECT_BINARY_DIR}/knowhere-config.cmake"
+    #"${PROJECT_BINARY_DIR}/knowhere-config-version.cmake"
+    DESTINATION "${KNOWHERE_INSTALL_CMAKEDIR}"
+    COMPONENT simdjson_Development
+)
+
diff --git a/cmake/knowhere-config.cmake.in b/cmake/knowhere-config.cmake.in
new file mode 100644
index 0000000..75db0cf
--- /dev/null
+++ b/cmake/knowhere-config.cmake.in
@@ -0,0 +1,4 @@
+include(CMakeFindDependencyMacro)
+
+
+include("${CMAKE_CURRENT_LIST_DIR}/knowhereTargets.cmake")
-- 
2.43.0

openSUSE Build Service is sponsored by