aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2015-05-12 19:52:26 -0700
committerJake Petroules <jake.petroules@petroules.com>2015-08-14 08:58:37 +0000
commit0abd1f7b723335df7a24da3e5194f8050dc635b8 (patch)
tree995c584b7e187be02ca1f7206558945879c7e6dc
parent6f6a2ef73ef2187b4e57fc8f059f337b04fd22e6 (diff)
Canonicalize project file path and build directory on project setup.v1.4.2
For example, on OS X, /tmp is a symlink to private/tmp, so attempting a build in /tmp would generate moc_*.cpp files whose number of ../ components would be incorrect when later resolved against the canonicalized path by the compiler, leading to build errors as a result of the included header not being found. Task-number: QBS-801 Change-Id: I85ce737baf77c98b860b61c27b24b7b017d9d19e Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r--src/lib/corelib/tools/setupprojectparameters.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/corelib/tools/setupprojectparameters.cpp b/src/lib/corelib/tools/setupprojectparameters.cpp
index 30499fe41..79712ae5f 100644
--- a/src/lib/corelib/tools/setupprojectparameters.cpp
+++ b/src/lib/corelib/tools/setupprojectparameters.cpp
@@ -36,6 +36,8 @@
#include <tools/scripttools.h>
#include <tools/settings.h>
+#include <QFileInfo>
+
namespace qbs {
namespace Internal {
@@ -151,6 +153,10 @@ QString SetupProjectParameters::projectFilePath() const
void SetupProjectParameters::setProjectFilePath(const QString &projectFilePath)
{
d->projectFilePath = projectFilePath;
+
+ const QString canonicalProjectFilePath = QFileInfo(d->projectFilePath).canonicalFilePath();
+ if (!canonicalProjectFilePath.isEmpty())
+ d->projectFilePath = projectFilePath;
}
/*!
@@ -173,6 +179,10 @@ QString SetupProjectParameters::buildRoot() const
void SetupProjectParameters::setBuildRoot(const QString &buildRoot)
{
d->buildRoot = buildRoot;
+
+ const QString canonicalBuildRoot = QFileInfo(d->buildRoot).canonicalFilePath();
+ if (!canonicalBuildRoot.isEmpty())
+ d->buildRoot = canonicalBuildRoot;
}
/*!