From 34af28ebafdb322bb95beb5d0bbb89d81ac5f697 Mon Sep 17 00:00:00 2001 From: Nob Shinjo <90700567+nobShinjo@users.noreply.github.com> Date: Mon, 2 Dec 2024 23:47:06 +0900 Subject: [PATCH] Fix: Resolve Boost FetchContent extraction issue on Windows - Updated FetchContent_Declare to use platform-specific archive formats. - On Windows, switched to the zip archive to avoid extraction errors caused by empty pathnames in tar.gz files. - For non-Windows platforms, the tar.gz archive remains the default. - Ensures compatibility and smooth extraction across all platforms. Related Issue: #60 --- cmake/boost.cmake | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/cmake/boost.cmake b/cmake/boost.cmake index a3cbccd..0518493 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -4,15 +4,25 @@ set(BOOST_IOSTREAMS_ENABLE_LZMA OFF) set(BOOST_IOSTREAMS_ENABLE_BZIP2 OFF) include(FetchContent) -FetchContent_Declare( - boost - URL https://github.com/boostorg/boost/releases/download/boost-1.81.0/boost-1.81.0.tar.gz - URL_HASH MD5=ffac94fbdd92d6bc70a897052022eeba - OVERRIDE_FIND_PACKAGE -) + +if(WIN32) + FetchContent_Declare( + boost + URL https://github.com/boostorg/boost/releases/download/boost-1.81.0/boost-1.81.0.zip + URL_HASH MD5=375693214b89309d2003f5296422c0a8 + OVERRIDE_FIND_PACKAGE + ) +else() + FetchContent_Declare( + boost + URL https://github.com/boostorg/boost/releases/download/boost-1.81.0/boost-1.81.0.tar.gz + URL_HASH MD5=ffac94fbdd92d6bc70a897052022eeba + OVERRIDE_FIND_PACKAGE + ) +endif() FetchContent_MakeAvailable(boost) -if (zlib_SOURCE_DIR) +if(zlib_SOURCE_DIR) target_include_directories(boost_iostreams PRIVATE ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) endif()