From eed787c1bfc1ed1585843923673e27354be7c0bd Mon Sep 17 00:00:00 2001
From: taynpg <taynpg@163.com>
Date: Wed, 16 Apr 2025 22:18:58 +0800
Subject: [PATCH] =?UTF-8?q?fs=EF=BC=9Aadd=20boost=20fs=20support?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 crashelper/CMakeLists.txt       | 9 +++++++++
 crashelper/include/crashelper.h | 7 -------
 crashelper/src/crashelper.cxx   | 8 ++++++++
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/crashelper/CMakeLists.txt b/crashelper/CMakeLists.txt
index 2ca4783..a9d3456 100644
--- a/crashelper/CMakeLists.txt
+++ b/crashelper/CMakeLists.txt
@@ -6,6 +6,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows")
 message(FATAL_ERROR "Unsupported MinGW Currently.")
 endif()
 
+if(DEFINED USE_BOOST)
+message(STATUS "crashelper use boost lib.")
+include_directories(${MBOOST_INCLUDE_DIR})
+endif()
+
 set(CRASHELPER_SOURCES
 src/crashelper.cxx
 )
@@ -25,4 +30,8 @@ else()
 message(FATAL_ERROR "Unsupported OS: ${CMAKE_SYSTEM_NAME}. This project only supports Linux, macOS, and Windows.")
 endif()
 
+if(DEFINED USE_BOOST)
+target_link_directories(crashelper PRIVATE ${MBOOST_LIB_DIR})
+target_link_libraries(crashelper PRIVATE ${MBOOST_LIBS})
+endif()
 target_include_directories(crashelper PUBLIC include)
\ No newline at end of file
diff --git a/crashelper/include/crashelper.h b/crashelper/include/crashelper.h
index 3f22b9d..9720dc2 100644
--- a/crashelper/include/crashelper.h
+++ b/crashelper/include/crashelper.h
@@ -18,13 +18,6 @@
 
 #include "backward.hpp"
 #include <string>
-#ifdef USE_BOOST
-#include <boost/filesystem.hpp>
-namespace fs = boost::filesystem;
-#else
-#include <filesystem>
-namespace fs = std::filesystem;
-#endif
 
 namespace backward {
 ///
diff --git a/crashelper/src/crashelper.cxx b/crashelper/src/crashelper.cxx
index c227d00..918f0b1 100644
--- a/crashelper/src/crashelper.cxx
+++ b/crashelper/src/crashelper.cxx
@@ -2,6 +2,14 @@
 #include <fstream>
 #include <string>
 
+#ifdef USE_BOOST
+#include <boost/filesystem.hpp>
+namespace fs = boost::filesystem;
+#else
+#include <filesystem>
+namespace fs = std::filesystem;
+#endif
+
 namespace backward {
 
 class crashHelper