1 /*
2     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
3 
4     SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "qmakeincludefile.h"
8 #include "qmakemkspecs.h"
9 #include <QString>
10 
QMakeIncludeFile(const QString & incfile,QMakeFile * parent,const VariableMap & variables)11 QMakeIncludeFile::QMakeIncludeFile(const QString& incfile, QMakeFile* parent, const VariableMap& variables)
12     : QMakeProjectFile(incfile)
13     , m_parent(parent)
14 {
15     m_variableValues = variables;
16 
17     setProject(parent->project());
18 
19     auto* pro = dynamic_cast<QMakeProjectFile*>(parent);
20     if (pro) {
21         setMkSpecs(pro->mkSpecs());
22         setQMakeCache(pro->qmakeCache());
23     } else {
24         auto* specs = dynamic_cast<QMakeMkSpecs*>(parent);
25         setMkSpecs(specs);
26     }
27 }
28 
pwd() const29 QString QMakeIncludeFile::pwd() const
30 {
31     return absoluteDir();
32 }
33 
outPwd() const34 QString QMakeIncludeFile::outPwd() const
35 {
36     auto* pro = dynamic_cast<QMakeProjectFile*>(m_parent);
37     if (pro) {
38         return pro->outPwd();
39     } else {
40         return absoluteDir();
41     }
42 }
43 
proFile() const44 QString QMakeIncludeFile::proFile() const
45 {
46     return m_parent->absoluteFile();
47 }
48 
proFilePwd() const49 QString QMakeIncludeFile::proFilePwd() const
50 {
51     return m_parent->absoluteDir();
52 }
53