views:

313

answers:

3

I'm trying to build a simple release build batch for our app. I'd like to use environment variables inside the <AppName>.cfg file. However these seem not to get expanded. Neither

-U"$(DELPHIKOMP)\VclZip;..."

nor

-U"%DELPHIKOMP%\VclZip;..."

work. However

-U"C:\DelphiKomp\VclZip;..."

does. Any idea what I'm doing wrong?

Please note: We're using BDS2006, so MSBuild is no option for now.

Update: As gabr suggested I wrote a little tool that expands the environment variables in my cfg and calls dcc32 for me. Thanks to all for their answers!

+1  A: 

Why not pass them as command line parameters to dcc32 - in that case the shell will expand them.

mghie
I'd like to be able to later reuse that batch file for other projects with different search paths. So I'd prefer to have the project specific stuff in the cfg file.
Ulrich Gerhardt
Well, you could use a separate .bat file in stead of the .cfg file, separated from the main build batch. Of course an imperative statement is not as elegant as specification of the options, but with a bit of discipline it's very workable. I use it at home all the time for builds (using cygwin makefiles at the office).
Paul-Jan
Well, there are a lot of options: A batch file for each project. A project-specific batch file setting a few env variables and calling the master build batch file. Or a Makefile, as $deity intended for building software artifacts. Or nant, or ...
mghie
+2  A: 

DCC32 doesn't support expansion of environment variables.

I'm pretty sure there exists a utility on the Internet which expands all variables in the cfg file, calls dcc32.exe and restores original cfg file, but I can't locate it anymore.

You can write such program pretty easily by yourself, though.

gabr
That's what I'm doing right now. :-)
Ulrich Gerhardt
+1  A: 

FWIW, using Delphi 2006 does not preclude MSBuild, or make, or another build tool; just shell out to dcc32 as necessary.

Barry Kelly