Files
abseil-cpp/absl/copts
Soo-Hwan Na 26ee072e14 PR #1710: fixup! PR #1707: Fixup absl_random compile breakage in Apple ARM64 targets
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1710

Use the SHELL: prefix in compile flag string to avoid passing it as quoted string
Introduced in CMake 3.12, but as CMake 3.16 is required by this project it will be ok.

According to https://cmake.org/cmake/help/latest/command/target_compile_options.html#option-de-duplication, CMake's target_compile_options ignores duplicate items, like from the quote of the link:

> While beneficial for individual options, the de-duplication step can break up option groups. For example, -option A -option B becomes -option A B. One may specify a group of options using shell-like quoting along with a SHELL: prefix.

This was our problem, -option A -option B should be there, but CMake just made it like -option A B, B was not guarded by -Xarch which led to a compilation error.

I originally tried the fix with quoting the "-option A", but it led to the quoted string passed to the compiler, and therefore ignored.
Now I am using the SHELL: suffix supported by CMake, and it shows differences:

> Current build command with quotes:
> ... -DNOMINMAX "-Xarch_x86_64 -maes" "-Xarch_x86_64 -msse4.1" ... (Wrong)

> With the SHELL: prefix applied:
> ... -DNOMINMAX -Xarch_x86_64 -maes -Xarch_x86_64 -msse4.1 ... (Correct)
Merge 661534618f into cd7f66cab5

Merging this change closes #1710

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1710 from Royna2544:master 661534618f
PiperOrigin-RevId: 651433382
Change-Id: I4c626e18ae8b33a8177ea79714b9678f955f469f
2024-07-11 09:17:51 -07:00
..