From eee7cdf07ef0c62b87078ef9ffcf202334ffaa77 Mon Sep 17 00:00:00 2001 From: Philip Hyunsu Cho Date: Fri, 13 Oct 2023 22:07:49 -0700 Subject: [PATCH] Fix build for GCC 8.x (#9670) (#9675) --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e5f2c556..460327385 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,6 +244,11 @@ add_subdirectory(rabit) add_subdirectory(${xgboost_SOURCE_DIR}/src) target_link_libraries(objxgboost PUBLIC dmlc) +# Link -lstdc++fs for GCC 8.x +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0") + target_link_libraries(objxgboost PUBLIC stdc++fs) +endif() + # Exports some R specific definitions and objects if(R_LIB) add_subdirectory(${xgboost_SOURCE_DIR}/R-package)