I was actually planning to add support for a nested <defines><define
name="..." /> ... </defines> element, but haven't yet got around to
implementing it (although its quite simple) ...
Gert
----- Original Message -----
From: "William E Caputo" <[EMAIL PROTECTED]>
To: "Sascha Andres <sa" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, November 21, 2003 3:35 PM
Subject: Re: [Nant-users] Conditional define
> sa:
> >I wanted to add a conditional define. That means if
> >variable xyz is set, add a define="XYZ" to the csc task. As
> >fas as I've seen, Imust put 2 csc task calls with if and
> >unless.
>
> >Is there a more elegant version of doing this?
>
> Given this code in "test.cs":
>
> using System;
>
> namespace EntryPoint {
> public class Test {
> public static void Main() {
> #if (XYZ)
> Console.WriteLine("XYZ is defined");
> #else
> Console.WriteLine("XYZ is not defined");
> #endif
> }
> }
> }
>
> The following build file will print the appropriate output depending on
> whether xyz is passed on the command line (e.g. nant -D:xyz=true):
>
> <project name="foo" default="run">
> <property name="defines" value="" />
> <if propertyexists="xyz">
> <property name="defines" value="XYZ" />
> </if>
>
> <target name="build">
> <csc target="exe" define="${defines}" output="result.exe">
> <sources>
> <includes name="test.cs"/>
> </sources>
> </csc>
> </target>
>
> <target name="run" depends="build">
> <exec program="result.exe" />
> </target>
> </project>
>
> Hope this helps.
>
> Best,
> Bill
>
> William E. Caputo
> ThoughtWorks, Inc.
> http://www.williamcaputo.com
> --------
> idia ktesis, koine chresis
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users