From d91a12bc8b0e2d25720d7e6adf48862cde980196 Mon Sep 17 00:00:00 2001 From: Thibault Malbranche Date: Tue, 8 Oct 2024 08:09:25 -0700 Subject: [PATCH] fix: override podspecs dependencies c++ version (#46888) Summary: Some dependencies would override C++ version like [this](https://github.com/mrousavy/react-native-vision-camera/blob/83abb0832a22b6b080f8412ed17b0992532b0eb2/VisionCamera.podspec#L36). We force it back to be the current version set by react-native so that we are sure projects are using the correct version [IOS] [FIXED] - Enforce we use the correct C++ version for all, even if dependency tries to set it Pull Request resolved: https://github.com/facebook/react-native/pull/46888 Test Plan: This can be test via https://github.com/Titozzz/cpp17bug Reviewed By: blakef Differential Revision: D64042099 Pulled By: cipolleschi fbshipit-source-id: c36dda0a718e52e19d53c3e9d895315141cb040c --- .../scripts/cocoapods/new_architecture.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index a4e9b720040..c25e2fbac5e 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -25,6 +25,19 @@ class NewArchitectureHelper project.save() end + + installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result| + target_installation_result.native_target.build_configurations.each do |config| + config.build_settings[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard + end + end + + # Override targets that would set spec.xcconfig to define c++ version + installer.aggregate_targets.each do |aggregate_target| + aggregate_target.xcconfigs.each do |config_name, config_file| + config_file.attributes[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard + end + end end def self.computeFlags(is_new_arch_enabled)