File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,18 @@ configure_file(
24
24
${CMAKE_CURRENT_BINARY_DIR} /config.hpp
25
25
)
26
26
27
+ if (DEFINED CMAKE_CXX_COMPILER_ID )
28
+ set (MONGOCXX_COMPILER_ID "${CMAKE_CXX_COMPILER_ID} " )
29
+ else ()
30
+ set (MONGOCXX_COMPILER_ID "Unknown" )
31
+ endif ()
32
+
33
+ if (DEFINED CMAKE_CXX_COMPILER_VERSION )
34
+ set (MONGOCXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION} " )
35
+ else ()
36
+ set (MONGOCXX_COMPILER_VERSION "Unknown" )
37
+ endif ()
38
+
27
39
configure_file (
28
40
${CMAKE_CURRENT_SOURCE_DIR} /private/config.hh.in
29
41
${CMAKE_CURRENT_BINARY_DIR} /private/config.hh
Original file line number Diff line number Diff line change 13
13
// limitations under the License.
14
14
15
15
#cmakedefine MONGOCXX_ENABLE_SSL
16
+ #cmakedefine MONGOCXX_COMPILER_ID "${MONGOCXX_COMPILER_ID}"
17
+ #cmakedefine MONGOCXX_COMPILER_VERSION "${MONGOCXX_COMPILER_VERSION}"
Original file line number Diff line number Diff line change 13
13
// limitations under the License.
14
14
15
15
#include < atomic>
16
+ #include < sstream>
16
17
#include < type_traits>
17
18
#include < utility>
18
19
@@ -90,7 +91,22 @@ class instance::impl {
90
91
} else {
91
92
libmongoc::log_set_handler (null_log_handler, nullptr );
92
93
}
93
- libmongoc::handshake_data_append (" mongocxx" , MONGOCXX_VERSION_STRING, NULL );
94
+
95
+ // Despite the name, mongoc_handshake_data_append *prepends* the platform string.
96
+ // mongoc_handshake_data_append does not add a delimitter, so include the " / " in the
97
+ // argument for consistency with the driver_name, and driver_version.
98
+ std::stringstream platform;
99
+ long stdcxx = __cplusplus;
100
+ #ifdef _MSVC_LANG
101
+ // Prefer _MSVC_LANG to report the supported C++ standard with MSVC.
102
+ // The __cplusplus macro may be incorrect. See:
103
+ // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
104
+ stdcxx = _MSVC_LANG;
105
+ #endif
106
+ platform << " CXX=" << MONGOCXX_COMPILER_ID << " " << MONGOCXX_COMPILER_VERSION << " "
107
+ << " stdcxx=" << stdcxx << " / " ;
108
+ libmongoc::handshake_data_append (
109
+ " mongocxx" , MONGOCXX_VERSION_STRING, platform.str ().c_str ());
94
110
}
95
111
96
112
~impl () {
You can’t perform that action at this time.
0 commit comments