diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2012-08-17 18:43:50 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2012-08-17 18:43:50 +0000 |
| commit | 455a0496b2dd9e56f625395c3b6e8d4f5404cbda (patch) | |
| tree | 0f96fe0e450258a09c277b4eecff0eaf6dd4c5e3 /clang/lib/Driver/ToolChains.cpp | |
| parent | d394c8a83e24150b713d0de21a7e85a07a81fadf (diff) | |
| download | bcm5719-llvm-455a0496b2dd9e56f625395c3b6e8d4f5404cbda.tar.gz bcm5719-llvm-455a0496b2dd9e56f625395c3b6e8d4f5404cbda.zip | |
darwin/driver: Support using SDKROOT to define the default for -isysroot.
- The SDKROOT environment variable is the de facto way to set the default SDK
for a number of tools, join forces with them.
llvm-svn: 162116
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 01c66239a12..5cf97b702b3 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -442,6 +442,20 @@ static bool GetVersionFromSimulatorDefine(StringRef define, void Darwin::AddDeploymentTarget(DerivedArgList &Args) const { const OptTable &Opts = getDriver().getOpts(); + // Support allowing the SDKROOT environment variable used by xcrun and other + // Xcode tools to define the default sysroot, by making it the default for + // isysroot. + if (!Args.hasArg(options::OPT_isysroot)) { + if (char *env = ::getenv("SDKROOT")) { + // We only use this value as the default if it is an absolute path and + // exists. + if (llvm::sys::path::is_absolute(env) && llvm::sys::fs::exists(env)) { + Args.append(Args.MakeSeparateArg( + 0, Opts.getOption(options::OPT_isysroot), env)); + } + } + } + Arg *OSXVersion = Args.getLastArg(options::OPT_mmacosx_version_min_EQ); Arg *iOSVersion = Args.getLastArg(options::OPT_miphoneos_version_min_EQ); Arg *iOSSimVersion = Args.getLastArg( |

