Good afternoon,

Hello everyone, I am new to this forum and new to Boost and CMake but eager to learn.  
So please forgive if this is a dumb question, but I am new to Boost and CMake.

I have had success using Boost.Iostreams with Linux OS and CMake using CPMPackageAdd call 
for boost_iostreams library using compression and decompression with the following
C++ code (the exact line of code that generates the error is shown below):

#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <vector>
#include <string>
#include <iostream>
#include <cstdlib>

using namespace boost::iostreams;

int main(int argc, char *argv[]) {
    // ---------------------------------
    //        - COMPRESS DATA -
    // ---------------------------------
    std::vector<char> v;
    back_insert_device<std::vector<char>> snk{v};
    filtering_ostream os;
    os.push(zlib_compressor{});  // This results in the Windows error zlib
    os.push(snk);
    os << "Boost" << std::flush;
    os.pop();

    // ---------------------------------
    //      - DECOMPRESS DATA -
    // ---------------------------------
    array_source src{v.data(), v.size()};
    filtering_istream is;
    is.push(zlib_decompressor{});
    is.push(src);
    std::string s;
    is >> s;
    std::cout << s << '\n';

    return EXIT_SUCCESS;
}

However, when I try to use the same code on a Windows machine with MSVC compiler it generates errors explaining that boost::iostreams::zlib is undefined during linking.
 
I am using CMakeLists.txt and would like to know if I can use CMake to properly build/compile for both Windows OS and Linux such that I can use the boost iostreams library with maybe an option in the CPMAddPackage call (maybe?). Is this possible? Can anyone point me in the correct direction with some simple example(s) if possible or links to existing solutions/hints to this same issue?

I appreciate any assistance with this. Thank you for your time.