2 * Copyright (C) 2005 Casper S. Hornstrup
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 Include::Include ( const Project
& project
,
27 const XMLElement
* includeNode
)
28 : project ( project
),
35 Include::Include ( const Project
& project
,
37 const XMLElement
* includeNode
)
38 : project ( project
),
45 Include::Include ( const Project
& project
,
48 : project ( project
),
53 this->directory
= NormalizeFilename ( basePath
+ SSEP
+ directory
);
54 this->basePath
= NormalizeFilename ( basePath
);
64 const XMLAttribute
* att
;
65 att
= node
->GetAttribute ( "base",
70 throw InvalidBuildFileException (
72 "'base' attribute illegal from global <include>" );
73 bool referenceResolved
= false;
74 if ( att
->value
== project
.name
)
77 referenceResolved
= true;
81 const Module
* base
= project
.LocateModule ( att
->value
);
85 basePath
= base
->GetBasePath ();
86 referenceResolved
= true;
89 if ( !referenceResolved
)
90 throw InvalidBuildFileException (
92 "<include> attribute 'base' references non-existant project or module '%s'",
94 directory
= NormalizeFilename ( basePath
+ SSEP
+ node
->value
);
97 directory
= NormalizeFilename ( node
->value
);