There are two approaches I use, I am sure there are others that work as well.
Firstly, using lazbuild : while in the IDE, you configure the various modes of your project, for the 'release' ones you turn off all the messages you don't want to see in project options, verbosity and messages. Then, when using lazbuild to build a project in that mode, those settings are applied.
Secondly, if you build directly using FPC instead of lazbuild, you pass things like " -vm6058,2005,5027 " to the compiler. Depending on what you are doing, building with FPC directly can get you a lot more flexibility.
Note that the 6058, relating to functions not being inlined does not exist in fpc304 so if you want to build "with any old compiler" your scripts need to check which compiler is being used (fpc -iV). I recently dropped support for fpc304 for just this reason. But mean I could remove a whole lot of ifdefs so not a bad thing.
Davo