We detect the implicit link directories for the toolchain by adding a
flag to get verbose output from the compiler front-end while linking the
ABI detection binary. Newer OS X toolchains based on Clang do not add
the implicit link directories with -L options to their internal
invocation of "ld". Instead they use a linker that comes with the
toolchain and is already configured with the proper directories.
Add the "-Wl,-v" option to ask "ld" to print its implicit directories.
It displays them in a block such as:
Library search paths:
/...
Parse this block to extract the implicit link directories.
While at it, remove the checks introduced by commit efaf335b (Skip
implicit link information on Xcode, 2009-07-23) and commit 5195a664
(Skip implicit link info for multiple OS X archs, 2009-09-22). Discard
the non-system link directories added by Xcode. Discard all detected
implicit libraries in the multi-architecture case but keep the
directories. The directories are still useful without the libraries
just to suppress addition of explicit -L options for them.
Drop the last use of CMAKE_OSX_SYSROOT_DEFAULT. Replace internal
platform variable CMAKE_${lang}_HAS_ISYSROOT with a more general
CMAKE_${lang}_SYSROOT_FLAG variable. If the -isysroot flag exists and
CMAKE_OSX_SYSROOT points to an SDK (not "/") then always add it to
compiler command lines. This is already done in the Xcode IDE.
Clang has the same interface as GNU except that we do not need to test
for the deployment target and sysroot flags. Simply set variables
CMAKE_${lang}_HAS_ISYSROOT
CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG
to true because every version of Clang available on OS X supports these
flags.