~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to projectmanagers/cmake/parser/cmakeprojectvisitor.cpp

  • Committer: Package Import Robot
  • Author(s): Pino Toscano, Andreas Cord-Landwehr
  • Date: 2014-01-18 10:13:08 UTC
  • mfrom: (1.3.21)
  • Revision ID: package-import@ubuntu.com-20140118101308-3o17vgglnms0emch
Tags: 4:4.5.2-1
* Team upload.
* New upstream release.

[ Andreas Cord-Landwehr ]
* Remove patch okteta_optional_structures_tool.diff, applied upstream.
* Bump build dependency for kdevplatform-dev to 1.5.2.
* Bump Standards-Version to 3.9.5: no changes needed.
* Update debian/watch file to track xz compressed tarballs (Closes: #731896)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
CMakeProjectVisitor::message_callback CMakeProjectVisitor::s_msgcallback=debugMsgs;
60
60
 
61
61
CMakeProjectVisitor::CMakeProjectVisitor(const QString& root, ReferencedTopDUContext parent)
62
 
    : m_root(root), m_vars(0), m_macros(0), m_topctx(0), m_parentCtx(parent), m_hitBreak(false)
 
62
    : m_root(root), m_vars(0), m_macros(0), m_topctx(0), m_parentCtx(parent), m_hitBreak(false), m_hitReturn(false)
63
63
{
64
64
}
65
65
 
472
472
                m_props[TargetProperty][id]["RUNTIME_OUTPUT_DIRECTORY"]=QStringList(locationDir);
473
473
            }
474
474
            break;
475
 
        case Target::Library:
 
475
        case Target::Library: {
476
476
            exe = QString("%1%2%3").arg(m_vars->value("CMAKE_LIBRARY_PREFIX").join(QString())).arg(id).arg(m_vars->value("CMAKE_LIBRARY_SUFFIX").join(QString()));
477
 
            if (m_vars->contains("CMAKE_LIBRARY_OUTPUT_DIRECTORY") && !m_vars->value("CMAKE_LIBRARY_OUTPUT_DIRECTORY").first().isEmpty()) {
478
 
                locationDir = m_vars->value("CMAKE_LIBRARY_OUTPUT_DIRECTORY").join(QString());
 
477
            QString l = m_vars->value("CMAKE_LIBRARY_OUTPUT_DIRECTORY").join(QString());
 
478
            if (!l.isEmpty()) {
 
479
                locationDir = l;
479
480
                m_props[TargetProperty][id]["LIBRARY_OUTPUT_DIRECTORY"]=QStringList(locationDir);
480
481
            }
481
 
            break;
 
482
            } break;
482
483
        case Target::Custom:
483
484
            break;
484
485
    }
626
627
        {
627
628
            kDebug(9042) << "including:" << path;
628
629
            walk(include, 0, true);
 
630
            m_hitReturn = false;
629
631
        }
630
632
        else
631
633
        {
742
744
            path=KUrl(path).pathOrUrl();
743
745
            kDebug(9042) << "================== Found" << path << "===============";
744
746
            walk(package, 0, true);
 
747
            m_hitReturn = false;
745
748
        }
746
749
        else
747
750
        {
755
758
        m_vars->removeMulti("CMAKE_CURRENT_LIST_FILE");
756
759
        m_vars->removeMulti("CMAKE_CURRENT_LIST_DIR");
757
760
        
758
 
        if(isConfig)
 
761
        if(isConfig) {
759
762
            m_vars->insert(pack->name()+"_FOUND", QStringList("TRUE"));
 
763
            m_vars->insert(pack->name().toUpper()+"_FOUND", QStringList("TRUE"));
 
764
        }
760
765
    }
761
766
    else
762
767
    {
1240
1245
            kDebug(9042) << "visited!" << call->name()  <<
1241
1246
                m_vars->value("ARGV") << "_" << m_vars->value("ARGN") << "..." << len;
1242
1247
 
 
1248
            m_hitReturn = false;
1243
1249
            if(isfunc)
1244
1250
                m_vars->popScope();
1245
1251
            //Restoring
1425
1431
    QList<KProcess*> procs;
1426
1432
    foreach(const QStringList& _args, exec->commands())
1427
1433
    {
1428
 
        if (_args.isEmpty())
 
1434
        if(_args.isEmpty())
1429
1435
        {
1430
1436
            kDebug(9032) << "Error: trying to execute empty command";
1431
1437
            break;
1432
1438
        }
 
1439
        
 
1440
        QString workingDir = exec->workingDirectory();
 
1441
        if(!QFile::exists(workingDir))
 
1442
        {
 
1443
            workingDir = m_vars->value("CMAKE_CURRENT_BINARY_DIR").join(QString());
 
1444
        }
1433
1445
        QStringList args(_args);
1434
1446
        KProcess *p=new KProcess(), *prev=0;
1435
1447
        if(!procs.isEmpty())
1436
1448
        {
1437
1449
            prev=procs.last();
1438
1450
        }
1439
 
        p->setWorkingDirectory(exec->workingDirectory());
 
1451
        p->setWorkingDirectory(workingDir);
1440
1452
        p->setOutputChannelMode(KProcess::MergedChannels);
1441
1453
        QString execName=args.takeFirst();
1442
1454
        p->setProgram(execName, args);
2199
2211
    return ret;
2200
2212
}
2201
2213
 
2202
 
enum RecursivityType { No, Yes, End, Break };
 
2214
enum RecursivityType { No, Yes, End, Break, Return };
2203
2215
 
2204
2216
RecursivityType recursivity(const QString& functionName)
2205
2217
{
2211
2223
        return End;
2212
2224
    else if(upperFunctioName=="break")
2213
2225
        return Break;
 
2226
    else if(upperFunctioName=="return")
 
2227
        return Return;
2214
2228
    return No;
2215
2229
}
2216
2230
 
2248
2262
//         kDebug(9042) << "At line" << line << "/" << fc.count();
2249
2263
 
2250
2264
        RecursivityType r = recursivity(it->name);
2251
 
        if(r==End || r==Break || m_hitBreak)
 
2265
        if(r==End || r==Break || r==Return || m_hitBreak || m_hitReturn)
2252
2266
        {
2253
2267
//             kDebug(9042) << "Found an end." << func.writeBack();
2254
2268
            m_backtrace.pop();
2256
2270
            
2257
2271
            if(r==Break)
2258
2272
                m_hitBreak=true;
 
2273
            if(r==Return)
 
2274
                m_hitReturn=true;
2259
2275
            return line;
2260
2276
        }
2261
2277