Qbs: Set cpp.xcodeSdkName and cpp.xcodeSdkVersion.

Change-Id: I17ef8c60589208810e9427187249b7a56c46b623
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Jake Petroules
2014-07-21 02:55:43 -04:00
parent 895421897e
commit 4d24a16059
2 changed files with 14 additions and 1 deletions

View File

@@ -39,6 +39,7 @@
#include <tools/hostosinfo.h>
#include <QDir>
#include <QFileInfo>
namespace QbsProjectManager {
@@ -60,8 +61,10 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
{
QTC_ASSERT(k, return defaultData);
QVariantMap data = defaultData;
const QString sysroot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput();
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
data.insert(QLatin1String(QBS_SYSROOT), ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput());
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
if (tc) {
@@ -122,6 +125,14 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
<< QLatin1String("llvm")
<< QLatin1String("gcc"));
}
// Set Xcode SDK name and version - required by Qbs if a sysroot is present
// Ideally this would be done in a better way...
QRegExp re(QLatin1String("(MacOSX|iPhoneOS|iPhoneSimulator)([0-9]+\\.[0-9]+)\\.sdk"));
if (re.exactMatch(QDir(sysroot).dirName())) {
data.insert(QLatin1String(CPP_XCODESDKNAME), re.cap(1).toLower() + re.cap(2));
data.insert(QLatin1String(CPP_XCODESDKVERSION), re.cap(2));
}
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
<< QLatin1String("unix"));