Closed ysc3839 closed 3 years ago
It seems that it is not a msgpack-c issue.
Yes, it's vcpkg's issue because it doesn't have a "all boost headers" package. If we know what components are used, we can install only used components.
msgpack-c is a header only library. And it uses only header-only part of the Boost Libraries. So you don't need to install any Boost library file e.g. .a .so .lib .dll The Boost.Test is used only for testing.
Here are boost types that is supported by msgpack-c https://github.com/msgpack/msgpack-c/tree/cpp_master/include/msgpack/adaptor/boost
I know msgpack-c uses only header-only part of boost.
The problem is, when using vcpkg install boost
to install boost, all boost components will be installed, including those not used by msgpack-c.
If you specify what boost components are used in find_package, for example: FIND_PACKAGE (Boost REQUIRED COMPONENTS preprocessor)
, then you can use vcpkg install boost-preprocessor
to install only this component.
Thanks. I personally don't use vcpkg. But you can send a pull request. It is welcome :)
I've checked cmake source code: https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake#L1013-L1372
There is no header only library name. e.g.) preprosessor.
So I can't add FIND_PACKAGE (Boost REQUIRED COMPONENTS preprocessor)
as you mentioned.
It causes cmake error.
I think that you can git clone
or download boost and then add include
directory to your include path.
See https://www.boost.org/doc/libs/1_77_0/more/getting_started/windows.html#header-only-libraries
Also I recommend that creating an issue for vcpkg.
component | link |
---|---|
assert | https://github.com/boostorg/assert |
numeric_conversion | https://github.com/boostorg/numeric_conversion |
variant | https://github.com/boostorg/variant |
utility (string_ref, string_view) | https://github.com/boostorg/utility |
fusion | https://github.com/boostorg/fusion |
optional | https://github.com/boostorg/optional |
predef | https://github.com/boostorg/predef |
preprosessor | https://github.com/boostorg/preprocessor |
MSGPACK_USE_X3_PARSE is defined
component | link |
---|---|
spirit(x3) | https://github.com/boostorg/spirit |
MSGPACK_BUILD_TESTS is defined
component | link |
---|---|
test | https://github.com/boostorg/test |
This is specified as follows:
FIND_PACKAGE (Boost REQUIRED COMPONENTS unit_test_framework system)
I've just checked https://vcpkg.io/en/packages.html. Maybe now you can use vcpkg as follows:
vcpkg install boost-assert boost-numeric-conversion boost-variant boost-utility boost-fusion boost-optional boost-predef boost-preprosessor
Be careful numeric_conversion
's vcpkg is numeric-conversion
.
I misunderstood that cmake find package and vcpkg are related. But it seems that it is completely different.
Sorry, I didn't test carefully before. It's not cmake reporting error, actually it's a compiler error. cmake can find boost correctly without specifying boost components in find_package. Just install other missing packages resolve the issue. Sorry again for my mistake, and thank you for helping resolve the issue!
When using vcpkg to install boost, it install all boost components, including components that require building. If we specify boost components in find_package, we can prevent building boost components.