Cpprestsdk mix boost versions when called

67 Views Asked by At

On our old (not so old) project, build on Windows and macOS with CMake, we use storically boost libraries, version 1.70. For new features, we need to include cpprestsdk libraries. cpprestsdk is downloaded for both Windows and macOS deployment from vcpkg. No problem on Windows, but on macOS at first call (in debug mode), I notice than from a certain point in the stack, the vcpkg downloaded library (Boost 1.83) make a call to a boost 1.70 function instead to resolve all calls only on 1.83 version. And this make a crash.

Where is the problem? How to isolate these two versions of boost, the old for all the project, and the new only on the library than use cpprestsdk?

I use macOS 13.5, XCode 14, CMake 3.27.5.

In the internal library, the CMakelists.txt appears like:

...
set(CMAKE_TOOLCHAIN_FILE "/Users/buildserver/vcpkg/scripts/buildsystems/vcpkg.cmake")

if( WIN32 )
    find_package(cpprestsdk CONFIG REQUIRED)
    target_link_libraries( ${MY_LIB} PRIVATE cpprestsdk::cpprest cpprestsdk::cpprestsdk_zlib_internal cpprestsdk::cpprestsdk_brotli_internal)
else( )
    find_package(cpprestsdk CONFIG REQUIRED)
    target_link_libraries( ${MY_LIB} PRIVATE cpprestsdk::cpprest cpprestsdk::cpprestsdk_zlib_internal cpprestsdk::cpprestsdk_boost_internal cpprestsdk::cpprestsdk_openssl_internal)
endif( WIN32 )
...
0

There are 0 best solutions below