Skip to content

Commit

Permalink
Fix: Resolve Boost FetchContent extraction issue on Windows
Browse files Browse the repository at this point in the history
- 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: SarahWeiii#60
  • Loading branch information
nobShinjo committed Dec 2, 2024
1 parent 935e6d7 commit 34af28e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cmake/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 34af28e

Please sign in to comment.