Issue-3613: Fix by rajanyadav0307 · Pull Request #3709 · aws/aws-sdk-cpp
Issue #, if available:
#3613
Description of changes:
This PR adds an opt-out CMake option to prevent the AWS SDK for C++ from exporting
the C++ language standard via pkg-config Cflags.
Currently, the generated .pc files include compiler policy flags (e.g.
-std=c++<N>, -fno-exceptions) derived from AWS_COMPILER_FLAGS. Downstream
projects that consume the SDK using pkg-config (for example, Meson or custom
build systems) blindly apply these flags, which can override the consumer’s
chosen C++ standard and cause build failures.
To address this without breaking existing users, this PR introduces a new option:
-DNO_CPPSTD_IN_PKG_CONFIG=ON
When enabled, the generated pkg-config Cflags will no longer include:
-std=c++<N>(primary issue reported)-fno-exceptions(also identified as leaking semantics into downstream builds)
The default behavior remains unchanged to preserve backward compatibility.
CMake-based consumers are unaffected, as these flags remain PRIVATE to SDK
targets.
Check all that applies:
-
Did a review by yourself.
-
Added proper tests to cover this PR.
Two Docker-based tests were used:
- One Dockerfile builds the upstream SDK and a minimal downstream project
to reliably reproduce the reported failure. Docker_Issue_Repro.zip
- A second Dockerfile builds the SDK with this patch enabled and verifies
that the downstream project builds successfully.Docker-Fix-Verify.zip -
Checked if this PR is a breaking (APIs have been changed) change.
-
Checked if this PR will not introduce cross-platform inconsistent behavior.
-
Checked if this PR would require a ReadMe/Wiki update.
Check which platforms you have built SDK on to verify the correctness of this PR.
- Linux
- Windows
- Android
- MacOS
- IOS
- Other Platforms
Screenshots:
By submitting this pull request, I confirm that you can use, modify, copy, and
redistribute this contribution, under the terms of your choice.
Sign-off: Rajan Y.(rajanyadav0307@gmail.com)

