From bd50c4a460a01dad3cd7cade8191273563675d24 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 4 Oct 2024 02:17:15 -0700 Subject: [PATCH] Make sure that all the pods in a project use the same C++ version (#46787) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46787 This issue was raised by a some partner that were integrating with libraries that were setting the wrong C++ version. With this change, RN takes ownership of the version of C++ that must be supported. ## Changelog [iOS][Breaking] - Cocoapods decide the C++ version for iOS pods Reviewed By: blakef Differential Revision: D63760271 fbshipit-source-id: 5e629c61accd97fb10a199430d31e8b4c73d482b --- .../scripts/cocoapods/new_architecture.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 079a6aae54f..f126ac4f4de 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -12,19 +12,26 @@ class NewArchitectureHelper @@NewArchWarningEmitted = false # Used not to spam warnings to the user. def self.set_clang_cxx_language_standard_if_needed(installer) + cxxBuildsettingsName = "CLANG_CXX_LANGUAGE_STANDARD" projects = installer.aggregate_targets .map{ |t| t.user_project } .uniq{ |p| p.path } projects.each do |project| - Pod::UI.puts("Setting CLANG_CXX_LANGUAGE_STANDARD to #{ Helpers::Constants::cxx_language_standard } on #{ project.path }") + Pod::UI.puts("Setting #{cxxBuildsettingsName} to #{ Helpers::Constants::cxx_language_standard } on #{ project.path }") project.build_configurations.each do |config| - config.build_settings["CLANG_CXX_LANGUAGE_STANDARD"] = Helpers::Constants::cxx_language_standard + config.build_settings[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard end 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 end def self.computeFlags(is_new_arch_enabled)