From 41327df2a93e8baca94e9e8a858d0aeb15105d50 Mon Sep 17 00:00:00 2001
From: Fawzi Mohamed <fawzi.mohamed@digia.com>
Date: Wed, 2 Apr 2014 03:16:09 +0200
Subject: [PATCH] ios: override spec for ios

On ios qmake is called recursively and the second call with a different
spec (macx-xcode instead of macx-ios-clang) which contains the
correct build settings (includes, compiler flags) as ios builds with
xcode.
macx-ios-clang just creates supporting makefiles, and to avoid being
slow does not evaluate everything, and contains misleading information
(that is never used), whereas macx-xcode correctly evaluates the
the variables and generates the xcodeproject that is actually used to
build the application.

It is important to override only for the creator evaluator, and not
the qmake buildstep used to build the app (as we use the makefiles).

Task-number: QTCREATORBUG-11908
Change-Id: I06d569de16f934fca5e104a8da727a3557a4c2e3
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
---
 src/plugins/qmakeprojectmanager/qmakeproject.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index bc0bee6b8d3..21fa44ede63 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -989,6 +989,20 @@ QtSupport::ProFileReader *QmakeProject::createProFileReader(const QmakeProFileNo
         m_qmakeGlobals->setCommandLineArguments(m_rootProjectNode->buildDir(), qmakeArgs);
 
         QtSupport::ProFileCacheManager::instance()->incRefCount();
+
+        // On ios, qmake is called recursively, and the second call with a different
+        // spec.
+        // macx-ios-clang just creates supporting makefiles, and to avoid being
+        // slow does not evaluate everything, and contains misleading information
+        // (that is never used).
+        // macx-xcode correctly evaluates the variables and generates the xcodeproject
+        // that is actually used to build the application.
+        //
+        // It is important to override the spec file only for the creator evaluator,
+        // and not the qmake buildstep used to build the app (as we use the makefiles).
+        const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants
+        if (qtVersion->type() == QLatin1String(IOSQT))
+            m_qmakeGlobals->xqmakespec = QLatin1String("macx-xcode");
     }
     ++m_qmakeGlobalsRefCnt;
 
-- 
GitLab