Skip to content

Commit 68306be

Browse files
authored
ASIO gRPC boost container fix (#174)
# Changes Moved a number of changes made manually into one of our repositories to the `find_package` code where it can be used globally.
1 parent 117b3f7 commit 68306be

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

FindAsioGrpc.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,39 @@
1212

1313
include("GenericFindDependency")
1414

15+
# asio-grpc has some logic to conditionally enable boost containers, this
16+
# should just be defaulted to false since the standard library offers the same
17+
# functionality.
18+
option(ASIO_GRPC_USE_BOOST_CONTAINER "(deprecated) Use Boost.Container instead of <memory_resource>" false)
19+
1520
GenericFindDependency(
1621
TARGET asio-grpc::asio-grpc-standalone-asio
1722
SOURCE_DIR asio-grpc
1823
SYSTEM_INCLUDES
1924
)
25+
26+
# Older libc++ versions like the one that ships with clang < v16 doesn't offer
27+
# the "memory_resource" standard header which is used by the library, instead
28+
# we conditionally select it to use "experimental/memory_resource" which is
29+
# available. The conditional selection is done via a customer preprocessor
30+
# which we've (Swift Navigation) introduced.
31+
include(CheckExperimentalMemoryResource)
32+
check_experimental_memory_resource(IS_EXPERIMENTAL_MEMORY_RESOURCE)
33+
if (IS_EXPERIMENTAL_MEMORY_RESOURCE)
34+
target_compile_definitions(asio-grpc-standalone-asio
35+
INTERFACE
36+
SWIFTNAV_EXPERIMENTAL_MEMORY_RESOURCE
37+
)
38+
endif()
39+
40+
# asio-grpc uses language features that are removed in c++20, the libc++
41+
# implementation actually removed these features unless you set a special
42+
# macro.
43+
include(CheckLibcpp)
44+
check_libcpp(IS_LIBCPP)
45+
if (IS_LIBCPP)
46+
target_compile_definitions(asio-grpc-standalone-asio
47+
INTERFACE
48+
_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
49+
)
50+
endif()

0 commit comments

Comments
 (0)