Search code examples
configurationc++builderc++builder-2007

Can I use configuration name in pre and post-build-events?


In Codegear RAD Studio 2007, I'm trying to do some file deletion and copying during the pre-build and post-build events that involve folders named after the current configuration. In Visual Studio, this is easily done with the $(ConfigurationName) macro.

Is there any equivalent to this in RAD Studio? If not, is there a workaround I can use?


Solution

  • I think what you're looking for $(Config). For example, in a prebuild event, you can add echo $(Config) and it will print a string like "Debug" or "Debug Build". I've tested it in Rad Studio 2010, but not in 2007. I believe they use the same configuration variable, though.

    If that doesn't work, open a cbproj file in an editor and look for something like this:

    <Config Condition="'$(Config)'==''">Debug</Config>
    

    Whatever word appears instead of 'Config' there may give you a clue.