From a16ef4cd803dd0aa9b5e40d6909254164caa21ee Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Wed, 2 Sep 2026 15:51:28 -0500 Subject: [PATCH] CMake: link libstdc++fs for GCC <9.0 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17579731b..7d620c709 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -977,6 +977,12 @@ endif() list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) +# GCC 8.x and earlier require explicit linking for std::filesystem +# See: https://gitlab.kitware.com/cmake/cmake/-/work_items/17834 +if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)) + list(APPEND EXTRA_LIBRARIES "stdc++fs") +endif() + if(NOT OPENBSD) option(USE_READLINE "Build with GNU readline support." ON) endif()