I recently stumbled across undocumented Delphi directives that were used to set the PE OS headers.

They are as follows:

Compiler directive usage
SETPEOSVERSION set OS Version fields in PE Header
SETPESUBSYSVERSION set Subsystem Version fields in PE Header
SETPEUSERVERSION set User Version fields in PE Header

The usage for these directives are as follows:

{$SETPEOSVERSION major.minor}

These compiler directives were probably introduced at the same time that the command line compiler introduced these, which was probably in Delphi 2010.