-
Notifications
You must be signed in to change notification settings - Fork 457
CDRIVER-6091 append C++ compiler to handshake #2114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
connorsmacd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if(DEFINED CMAKE_CXX_COMPILER_ID) | ||
| set(MONGOC_CXX_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") | ||
| endif() | ||
|
|
||
| if(DEFINED CMAKE_CXX_COMPILER_VERSION) | ||
| set(MONGOC_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}") | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding a comment to the check_language (CXX) -> enable_language (CXX) in the root CMakeLists.txt documenting that these optional compiler ID + version handshake metadata is dependent on them (no longer just for "some C++-specific tests"):
Lines 229 to 240 in 340b1f4
| # Optionally enable C++ to do some C++-specific tests | |
| include (CheckLanguage) | |
| check_language (CXX) | |
| if (CMAKE_CXX_COMPILER) | |
| enable_language (CXX) | |
| if (NOT CMAKE_CXX_STANDARD) | |
| # Default to C++11 for purposes of testing. | |
| set (CMAKE_CXX_STANDARD 11) | |
| endif () | |
| else () | |
| message (STATUS "No CXX support") | |
| endif () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Comment updated.
Summary
Append detected C++ compiler to handshake.
Verified with this patch build: https://spruce.mongodb.com/version/68c08e74190e6700073c344b
Background & Motivation
See CDRIVER-6091. Knowing if a C++ compiler was detected may help inform future decisions.
Example from the handshake before:
{ "driver": { "name": "mongoc", "version": "2.2.0-pre" }, "os": { "type": "Linux", "name": "Ubuntu", "version": "22.04", "architecture": "x86_64" }, "platform": "cfg=0x06235e88e9 posix=200809 stdc=199901 CC=GCC 11.4.0 CFLAGS=\"\" LDFLAGS=\"\"" }This PR adds
CXXto theplatformstring of the MongoDB Handshake:If a C++ compiler is not found,
CXX=Unknownis included. Alternatively:CXXcould be omitted if not detected. But I expect it may help with analysis to easily distinguish between: "driver too old to check" and "checked and did not find".