Package: libboost-iostreams-dev
Version: 1.83.0.2
Severity: normal

Hi! Stumbled upon `libboost-iostreams-dev` not providing all dependencies, 
leading to issue during linking.

For example:
```sh
sudo apt-get install -y libboost-iostreams-dev
mkdir build && cd build
cmake ..
# /usr/bin/ld: cannot find -lbz2: No such file or directory
# /usr/bin/ld: cannot find -llzma: No such file or directory
# /usr/bin/ld: cannot find -lz: No such file or directory
# /usr/bin/ld: cannot find -lzstd: No such file or directory
make

sudo apt-get install -y liblzma-dev libzstd-dev libbz2-dev zlib1g-dev
# Build succeeds.
make
```

Issue is caused by cmake config `libboost_iostreams-variant-static.cmake` 
having those libraries as dependencies:
```cmake
if(CMAKE_CONFIGURATION_TYPES)
  set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    "$<$<CONFIG:release>:bz2;lzma;z;zstd>")
else()
  set_property(TARGET Boost::iostreams APPEND PROPERTY INTERFACE_LINK_LIBRARIES
    bz2 lzma z zstd)
endif()
```

cmake file used:
```cmake
cmake_minimum_required(VERSION 3.21)
project(test-cmake)

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost CONFIG REQUIRED COMPONENTS iostreams)
# main.cpp is not important - just some hello world.
add_executable(main main.cpp)
message(STATUS "libs are ${Boost_LIBRARIES}")
target_link_libraries(main PRIVATE Boost::iostreams)
```

Reply via email to