[CXX-1348] Remove -Werror from CMAKE_CXX_FLAGS around calls to generate_export_header() Created: 25/May/17  Updated: 28/Oct/23  Resolved: 06/Nov/17

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CXX-1462 Adding -Werror on CMake command line ... Closed
Related
is related to CXX-1056 Add mechanism to disable deprecation ... Closed
Epic Link: CXX Driver Testing (Evergreen)

 Description   

generate_export_header() (from the GenerateExportHeader CMake module) adds a configure test to see whether the compiler supports a "deprecated" attribute. Unfortunately, this configure test interacts poorly with the -Werror: if -Werror is contained in CMAKE_CXX_FLAGS, then this configure test always fails, because the deprecation warning generated by the configure program is always promoted to an error (and an error is supposed to indicate that the compiler lacks support for such an attribute).

As such, all of our CI builders which specify -Werror in CMAKE_CXX_FLAGS are declaring BSONCXX_DEPRECATED/MONGOCXX_DEPRECATED as empty macros.

As a temporary workaround, we could programmatically remove -Werror from CMAKE_CXX_FLAGS right before calling generate_export_header(), and add it back after the generate_export_header() call if the removal attempt was successful.



 Comments   
Comment by Githook User [ 06/Nov/17 ]

Author:

{'name': 'Andrew Morrow', 'username': 'acmorrow', 'email': 'acm@mongodb.com'}

Message: CXX-1348 Force enable deprecation attributes
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/408f1fe9bf918f70d83f83c222feed98e5f28129

Comment by Andrew Morrow (Inactive) [ 04/Nov/17 ]

This is easily solved by adding -DCOMPILER_HAS_DEPRECATED_ATTR:Bool=true to our CMake invocations in evergreen.

Generated at Wed Feb 07 22:02:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.