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
This commit is contained in:
Riccardo Cipolleschi
2024-10-04 02:17:15 -07:00
committed by Facebook GitHub Bot
parent 309cdea337
commit bd50c4a460
@@ -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)