diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91cdefa8e888c5f4c610cc6d014d0e8bcf8ea18b..402aaf8df925f5a592794bdd535694eecfb1e034 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,6 +168,7 @@ else()
 endif()
 target_link_libraries(caosdb
     ${CONAN_LIBS}
+    stdc++fs
 )
 target_include_directories(caosdb PUBLIC
     $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
@@ -182,6 +183,7 @@ add_library(ccaosdb SHARED src/ccaosdb.cpp)
 target_link_libraries(ccaosdb
     ${CONAN_LIBS}
     ${LIBCAOSDB}
+    stdc++fs
 )
 target_include_directories(ccaosdb PUBLIC
     $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
diff --git a/doc/legacy.rst b/doc/legacy.rst
new file mode 100644
index 0000000000000000000000000000000000000000..485397ea116c6d06b1defa99d4f4bbc31853ab4b
--- /dev/null
+++ b/doc/legacy.rst
@@ -0,0 +1,6 @@
+Legacy code
+===========
+
+- Older GCC compilers (before gcc-9) need explicit linking against libstdc++fs.a.  The related
+  specifications can be removed from the CMakeLists.txt files once no such compilers are expected in
+  the wild anymore.