File tree Expand file tree Collapse file tree 6 files changed +42
-0
lines changed
include/bsoncxx/v_noabi/bsoncxx/stdx Expand file tree Collapse file tree 6 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ function(bsoncxx_add_library TARGET OUTPUT_NAME LINK_TYPE)
117117 DEFINE_SYMBOL BSONCXX_EXPORT
118118 )
119119
120+ if (BSONCXX_API_OVERRIDE_DEFAULT_ABI)
121+ target_compile_definitions (${TARGET} PUBLIC BSONCXX_API_OVERRIDE_DEFAULT_ABI)
122+ endif ()
123+
120124 if (ENABLE_ABI_TAG_IN_LIBRARY_FILENAMES)
121125 set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}${abi_tag} )
122126 else ()
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ function(mongocxx_add_library TARGET OUTPUT_NAME LINK_TYPE)
7979 DEFINE_SYMBOL MONGOCXX_EXPORTS
8080 )
8181
82+ if (MONGOCXX_API_OVERRIDE_DEFAULT_ABI)
83+ target_compile_definitions (${TARGET} PUBLIC MONGOCXX_API_OVERRIDE_DEFAULT_ABI)
84+ endif ()
85+
8286 if (ENABLE_ABI_TAG_IN_LIBRARY_FILENAMES)
8387 set_target_properties (${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}${abi_tag} )
8488 else ()
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ message(STATUS "bsoncxx version: ${BSONCXX_VERSION}")
2323option (BSONCXX_POLY_USE_IMPLS "Use bsoncxx implementations for stdx polyfills" OFF )
2424option (BSONCXX_POLY_USE_STD "Use C++17 std library for stdx polyfills" OFF )
2525
26+ option (BSONCXX_API_OVERRIDE_DEFAULT_ABI "The default ABI namespace to use for root namespace redeclarations" OFF )
27+ mark_as_advanced (BSONCXX_API_OVERRIDE_DEFAULT_ABI)
28+ if (BSONCXX_API_OVERRIDE_DEFAULT_ABI)
29+ message (WARNING "BSONCXX_API_OVERRIDE_DEFAULT_ABI is an experimental feature" )
30+ endif ()
31+
2632set (BSONCXX_OUTPUT_BASENAME "bsoncxx" CACHE STRING "Output bsoncxx library base name" )
2733
2834# Count how many polyfill options are true-ish
Original file line number Diff line number Diff line change @@ -34,13 +34,26 @@ using v1::stdx::optional;
3434namespace bsoncxx {
3535namespace stdx {
3636
37+ #if defined(BSONCXX_API_OVERRIDE_DEFAULT_ABI)
38+
39+ using v1::stdx::in_place;
40+ using v1::stdx::in_place_t ;
41+ using v1::stdx::make_optional;
42+ using v1::stdx::nullopt ;
43+ using v1::stdx::nullopt_t ;
44+ using v1::stdx::optional;
45+
46+ #else
47+
3748using v_noabi::stdx::in_place;
3849using v_noabi::stdx::in_place_t ;
3950using v_noabi::stdx::make_optional;
4051using v_noabi::stdx::nullopt ;
4152using v_noabi::stdx::nullopt_t ;
4253using v_noabi::stdx::optional;
4354
55+ #endif // defined(BSONCXX_API_OVERRIDE_DEFAULT_ABI)
56+
4457} // namespace stdx
4558} // namespace bsoncxx
4659
Original file line number Diff line number Diff line change @@ -30,9 +30,18 @@ using v1::stdx::string_view;
3030namespace bsoncxx {
3131namespace stdx {
3232
33+ #if defined(BSONCXX_API_OVERRIDE_DEFAULT_ABI)
34+
35+ using v1::stdx::basic_string_view;
36+ using v1::stdx::string_view;
37+
38+ #else
39+
3340using v_noabi::stdx::basic_string_view;
3441using v_noabi::stdx::string_view;
3542
43+ #endif // defined(BSONCXX_API_OVERRIDE_DEFAULT_ABI)
44+
3645} // namespace stdx
3746} // namespace bsoncxx
3847
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ message(STATUS "mongocxx version: ${MONGOCXX_VERSION}")
2323option (MONGOCXX_ENABLE_SSL "Enable SSL - if the underlying C driver offers it" ON )
2424option (MONGOCXX_ENABLE_SLOW_TESTS "Run slow tests when invoking the the test target" OFF )
2525
26+ option (MONGOCXX_API_OVERRIDE_DEFAULT_ABI "The default ABI namespace to use for root namespace redeclarations" OFF )
27+ mark_as_advanced (MONGOCXX_API_OVERRIDE_DEFAULT_ABI)
28+ if (MONGOCXX_API_OVERRIDE_DEFAULT_ABI)
29+ message (WARNING "MONGOCXX_API_OVERRIDE_DEFAULT_ABI is an experimental feature" )
30+ endif ()
31+
2632set (MONGOCXX_OUTPUT_BASENAME "mongocxx" CACHE STRING "Output mongocxx library base name" )
2733
2834set (MONGOCXX_PKG_DEP "" ) # Required by mongocxx-config.cmake.in.
You can’t perform that action at this time.
0 commit comments