The postbuildcommands function specifies shell commands to run after build is finished.
postbuildcommands { "commands" }
Applies To
Solutions, projects, and configurations.
Parameters
commands is one or more shell commands. These commands will be passed to the shell exactly as entered, including path separators and the like.
See Also
prebuildcommands
prelinkcommands
Examples
configuration "windows" postbuildcommands { "copy default.config bin\\project.config" } configuration "not windows" postbuildcommands { "cp default.config bin/project.config" }



It would be nice if you could specify that the postbuild command is the executable created by the application itself. For unit tests it is recommended to do so, so that the tests are run every time they are built, which is what you usually want to do after the test executable is built.
When doing it manually, with Visual Studio it is best to use $(TargetPath), with Code::Blocks it is $exe_output, but of course PreMake could figure it out itself.
An optional comment about the postbuild command would also be nice, some IDEs like Visual Studio have a description field for that, that is printed on the console before the postbuild command is executed (e.g. "Unit testing...").
Excellent suggestions @Anonymous! You should enter them in the feature requests tracker where everyone can see them.
For gmake at least, the commands are not run if the target is already up to date. Is this a bug?
I would consider the "build finished" even if nothing needed to be done, but I guess it is a matter of interpretation.
@ergosys: No not a bug, that's by design. Perhaps we need another target though, like "postbuildalways"?
It would be useful. My naming idea: uptodatecommands, fwiw.
I wanted to know whether Anon's suggestions (posted on 02 Sep 2010 09:51) has been implemented or is there any other way to actually do that.
What I'd like to be able to do is to have access to the file names and other specifics of a build process in the shell commands. For example, to copy the output file of a build to another directory:
postbuildcommands { "copy " .. outputfile .. " ..\\distro\\" }or something like that. Is there a way to do that? (I know I can write configuration-specific commands, but in a solution with a few projects, 6 configurations, 2 platforms and 2 operating systems, which are built using at least a couple of compilers, the combinations get quite out of hand!)
Any information, pointers, hacks, workarounds, etc. is greatly appreciated!