Build against the rocksdb of the distribution

Like collocatordb, which no longer needs a rocksdb 5.11 built from source.
The build asked for librocksdb.a unconditionally, which distributions that
package rocksdb do not necessarily ship; only a static dereko2vec really needs
it, otherwise any rocksdb will do. CI installs librocksdb-dev instead of
building rocksdb twice.

ccache is guarded the same way as in derekovecs: it only makes the build
faster, so a missing ccache must not stop the pipeline at --show-stats.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I17ca8cfb3b092ccc646db3ff84c88f2c4391f068
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3baa2d4..f6faee7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,10 +19,17 @@
     message(FATAL_ERROR "No libcollocatordb_static.a found. Please install from https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb")
 endif ()
 
-find_library(ROCKSDB librocksdb.a REQUIRED)
-if (NOT ROCKSDB)
-    message(FATAL_ERROR "No librocksdb.a found. Please install like suggested here https://korap.ids-mannheim.de/gerrit/plugins/gitiles/private/collocatordb#install-rocksdb-and-prerequisites")
+# No version pin, so that the rocksdb of the distribution can be used. A static
+# build needs the static library, otherwise a shared one will do as well.
+if (STATIC_DEREKO2VEC)
+    find_library(ROCKSDB librocksdb.a REQUIRED)
+else ()
+    find_library(ROCKSDB NAMES rocksdb REQUIRED)
 endif ()
+if (NOT ROCKSDB)
+    message(FATAL_ERROR "No rocksdb found. Install the rocksdb development package of your distribution, e.g. librocksdb-dev or rocksdb-devel.")
+endif ()
+message(STATUS "Using RocksDB library ${ROCKSDB}")
 
 file(GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c)
 foreach (mysourcefile ${APP_SOURCES})