cmake "find asio" weirdness
Closed this issue · 5 comments
Hi,
Asio typically comes with boost, and boost does not install a "Findasio.cmake" file. This causes a cmake faile. (I'm using v3.25.1.) Chris Kohlhoff does not provide cmake files either.
To install through cmake, I ended up patching cmake/AsioGrpcFindPackages.cmake
, replacing find_package(asio)
with:
SET(_asio_grpc_asio_root "${CMAKE_PREFIX_PATH}/include/boost")
Note that CMAKE_PREFIX_PATH/include/boost
is the most likely place to find the header asio.hpp.
If you are just looking to install asio-grpc then AsioGrpcFindPackages.cmake
won't even be included (because ASIO_GRPC_BUILD_TESTS
is off), so I am assuming that you are looking to contribute. I must say that I have only ever used vcpkg for that, which, just like conan and hunter, generates a asioConfig.cmake
that is compatible with find_package. Hence find_package(asio)
works just fine with those package managers.
Also, due to find_path(_asio_grpc_asio_root ...)
you can also define the CMake cache variable directly instead of patching the source code, for example on the command like -D_asio_grpc_asio_root=
On a side note, find_package(asio)
is there to find the standalone version of Asio, the Boost version is of course covered by find_package(Boost)
.
Hi @aaron-michaux,
are you still facing issues? If yes, could you elaborate more on what you are trying to do?
Hi, I've been rolling my own implementation in order to better understand both P2300, and grpc. (Although I think they're changing their execution model soon.)
However, I will run some tests on the weekend, and get back to you -- appreciate that it can be hard to test code outside of your own implementation testbed.
@aaron-michaux hi, did you find the time to run your tests? You do not have to if you do not want to, I am simply curious to find out what issues people that want to contribute to asio-grpc might face. I know it can be a bit difficult due to the triplet of Boost.Asio, standalone Asio and unifex as well as doctest+gtest. I could try to conditionally disable tests based on the presence of those dependencies if that helps.
I'm sorry, I never ran the tests, and feel a little burnt out. Thank you for your help.