Apple: Enable -Wl,-search_paths_first for non-macOS platforms
When building for Apple device platforms, don't expect CMAKE_SYSTEM_VERSION
to be set and don't set DARWIN_MAJOR_VERSION
. In turn, don't erroneously query the latter to determine whether the -search_paths_first
linker flag is supported. It is expected to be available for all Apple SDKs that we now support.
Projects may be relying on the linker flag not being added, so add a policy to provide backward compatibility for this change.
NOTE: This was split out of !5980 (merged).