Code::Blocks Forums

User forums => Help => Topic started by: JeDi on April 09, 2006, 05:24:30 pm

Title: using project variables in project files
Post by: JeDi on April 09, 2006, 05:24:30 pm
Hi,

Is using the internal variables ($(PROJECT_NAME), ...) supported in the .cdp files? I tried creating a user template, and wanted to use for example <Unit filename="../../src/$(PROJECT_NAME)/global.h">, but that gave me an error, the variable doesn't seem to be replaced while loading the project.

Any thoughts?

Greetz,
JeDi
Title: Re: using project variables in project files
Post by: thomas on April 09, 2006, 06:37:31 pm
That is correct, the project loader does not replace variables, and for the sake of performance, I think it shouldn't, either. Variable replacement is something that takes a non-trivial amount of CPU-time.
It is very well possible to build templates without using variables in units, so there is no urgent need for this, either.

Those variables are thought to give you some flexibility during the build process, not to define the layout of a new project. If you want to make the layout customisable, use a template script (this is supported). That will evaluate once, not at every startup, which is better.
Title: Re: using project variables in project files
Post by: JeDi on April 10, 2006, 12:47:19 pm
So you're saying that the variables do work in the other parts of the project (include dirs, output dirs, ...)? Cause I don't need it in the units, that was just to test it. And you say template scripts are supported? So I can create a script that creates a dir, put some source files in it, replace some stuff in the source files? That would be very cool (and a lot better than visual studio).

Do you have any special links for this feature? Or should I just search a tutorial on AngelScript?

Thanks!
Greetz,
JeDi
Title: Re: using project variables in project files
Post by: Michael on April 10, 2006, 12:51:42 pm
Do you have any special links for this feature? Or should I just search a tutorial on AngelScript?

Hello,

Did you try to search in the forum? There should be something useful :).

Best wishes,
Michael
Title: Re: using project variables in project files
Post by: thomas on April 10, 2006, 02:36:53 pm
So you're saying...
Yes, yes, and yes.
Title: Re: using project variables in project files
Post by: JeDi on April 10, 2006, 03:47:53 pm
In the few days I'm trying Code::Blocks, I'm starting to like it very much :-)

For the template scripts, I can't really find that much information. I looked into some of the .template files provided with codeblocks, but it doesn't seem I can do the things I want with it. However, I read somewhere that you guys were working on a wizard-system. How is that going? Can I find some more technical information about it somewhere?

Greetz,
JeDi