Is it possible to create a conditional pre-build step (based on a custom variable)? Basically I need to be able to dynamically generate a file that contains the svn version of HEAD and write it to a file. I currently have:
cmd /c if $(SVN_BUILD) == yes svn info --revision HEAD | grep Revision | sed -e "s/Revision:/#define SVN_VERSION/" > svnversion.h
But this is to me is really cludgy because it's dependant on the 'if' functionality built in to cmd. Is there a 'native' if / then / else, etc. that can be used in the pre-build steps?
Hi ironhead,
yes it is possible to make a conditional pre/post-build step. In the user manual chapter "variable expansion" in the section "conditional evaluation" you will find an example.
[[ if (PLATFORM == PLATFORM_MSW) { print (_T("cmd /c")); } else { print (_T("sh ")); } ]] <command>
Bye,
Mario
How do I check a project specific Custom Variable?
I have SVN_BUILD = 0 in the projects Custom Variable tab, in the pre-build, for testing I have:
[[ if ($SVN_BUILD == 0) { print (_T("cmd /c")); } ]] echo hello
But I get an expression expected error. Am I accessing the Custom Variable in the wrong way?
I'm getting there, I know have:
$if(SVN_BUILD){cmd /c echo true}
which works if I have:
In that the 'true' clause isn't executed. The problem is that when using SVN_BUILD (or $SVN_BUILD or $(SVN_BUILD)) the 'true' clause is always being execute, despite the fact that I've defined SVN_BUILD as '0' (or if I leave it undefined) in the Custom Variables tab. I take it I'm missing something?