don't generate bogus TARGETs
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Fri, 24 Feb 2012 08:10:52 +0000 (09:10 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 27 Feb 2012 19:52:45 +0000 (20:52 +0100)
Change-Id: Ia99cd8862157e5630506d02b3c7e9b35d4bc3302
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
qmake/generators/projectgenerator.cpp

index 4d1a310..a2eb45e 100644 (file)
@@ -85,12 +85,6 @@ ProjectGenerator::init()
         templ.prepend(Option::user_template_prefix);
     v["TEMPLATE_ASSIGN"] += templ;
 
-    //figure out target
-    if(Option::output.fileName() == "-")
-        v["TARGET_ASSIGN"] = QStringList("unknown");
-    else
-        v["TARGET_ASSIGN"] = QStringList(QFileInfo(Option::output).baseName());
-
     //the scary stuff
     if(project->first("TEMPLATE_ASSIGN") != "subdirs") {
         QString builtin_regex = project_builtin_regx();
@@ -360,6 +354,12 @@ ProjectGenerator::writeMakefile(QTextStream &t)
         t << endl << "# Directories" << "\n"
           << getWritableVar("SUBDIRS");
     } else {
+        //figure out target
+        QString ofn = QFileInfo(static_cast<QFile *>(t.device())->fileName()).completeBaseName();
+        if (ofn.isEmpty() || ofn == "-")
+            ofn = "unknown";
+        project->variables()["TARGET_ASSIGN"] = QStringList(ofn);
+
         t << getWritableVar("TARGET_ASSIGN")
           << getWritableVar("CONFIG", false)
           << getWritableVar("CONFIG_REMOVE", false)