Vcpkg: Can't find boost with VS2017.

Created on 29 Jan 2017  路  10Comments  路  Source: microsoft/vcpkg

CMake's FindBoost looks for libraries tagged with -vc150- when configuring for VS2017, while our Boost always uses vc140 tag (so I guess it compiles itself with VS2015). This is still the case with 1.63 update.

I'm not familiar with Boost's buildsystem but maybe it needs to be explicitly told which toolset should be used?

port-bug

All 10 comments

Sigh. It looks like we have two issues here; first,聽we need to fix the boost聽portfile to聽build with VS2017.聽Second, we need聽to make the user's find_package(Boost) work聽regardless of whether聽Boost聽was built with v140 or v141 (the official term for VS2017's default toolchain).

As much as we've tried to avoid it, I suspect the only way to properly handle聽Boost is to聽special-case it in our CMake Toolchain file and override the configuration variables for the consuming project. We've been avoiding special treatment on a聽per-library聽basis here, but I don't see much of an alternative.

In this particular case,聽it looks like the best option is to set Boost_COMPILER to "-vc140"聽and to聽always rename the output .lib files to聽look like they used the聽vc140 toolset. The DLL names will remain unchanged, however, so聽they can still聽sit side-by-side at deployment time for users who are relying on that behavior.

This would correctly enable the cross scenarios of聽v141 boost -> v140 project and v140 boost -> v141 project.

This would correctly enable the cross scenarios of v141 boost -> v140 project and v140 boost -> v141 project.

Should those scenarios be supported at all?
AFAIK major versions of MSVC are not guaranteed to be compatible.

How is this done for other libs?
IMO the libs should be separated per compiler, like it done with the triplets for platforms.

AFAIK major versions of MSVC are not guaranteed to be compatible.

v141 guaranteed to be compatible with v140 and backward

Yes, but 2013 and 2015 aren't compatible so this structural problem will have to be solved some time.

For totally incompatible toolchains (for example, v120, v140, and clang-android) we聽can handle those with entirely separate triplets. For example, x86-win-v120 and聽x64-win-v120-static.聽This聽ensures that you can, within a single vcpkg enlistment,聽make聽a functional zlib available for every version of VS you use and for every compilation target.

The rationale behind聽merging聽v141 and聽v140 is that they _are_聽completely compatible with each other, so there's little聽benefit to segregate them by default. We聽do have a highly-experimental-undocumented聽option聽[1] that can be added to your triplet file to try to force聽the v140 toolset even if you have v141, but it doesn't seem聽worth聽investing in聽making it聽"production聽quality" so far.

[1] If you want to play with it (note: will change at any time), it's set(VCPKG_TOOLSET_VERSION v140) in a triplet file.

Ok, I've checked in the first half of the above change with b2b2c91.聽Boost_COMPILER will now be overridden to be -vc140 for all packages and all projects built using our toolchain file. I confirmed this fixed cpprestsdk, and I'm currently confirming that it fixes #626.

I聽have the second half of this prepped locally (renaming the聽-vc150聽libs to -vc140), however聽we currently _aren't_ building boost聽using聽VS2017 so I have not been able to test that yet.聽I'm seeking to聽simultaneously add 2017聽builds for boost as well as adding the renaming, which should prevent聽regression here.

That said, the聽fix in b2b2c91聽does resolve the聽original issue posted here, so I'll close this issue. Please聽let me know聽if you find a package that is still not correctly locating the boost libraries.

Thanks for communicating with the聽boost project, @KindDragon!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tzbo picture tzbo  路  3Comments

ghost picture ghost  路  3Comments

PhilLab picture PhilLab  路  3Comments

jack17529 picture jack17529  路  3Comments

cjvaijo picture cjvaijo  路  3Comments