Replace <OBJECT_DIR> rule placeholder consistently (#14667)

The <OBJECT_DIR> placeholder is supposed to be the base intermediate
files directory for the current target.  This is how it gets replaced
during link line generation.  However, during compile line generation
we replace it with the directory containing the current object file
which may be a subdirectory.  Fix replacement of <OBJECT_DIR> in the
generated compile lines to be the base intermediate files directory.

This was expoxed by commit 42ba1b08 (VS: Separate compiler and linker
PDB files, 2013-04-05) when we added a "/Fd<OBJECT_DIR>/" flag to the
MSVC compile line in order to match the VS IDE default compiler program
database location in the intermediate files directory.  For source files
in a subdirectory relative to the current target this caused the wrong
location to be used for the compiler program database.  This becomes
particularly important when using precompiled headers.

While at it, use the local generator GetTargetDirectory method to
compute the intermediate filres directory for the current target
instead of repeating the logic in a few places.
Merge topic 'fix-compile-OBJECT_DIR' into next

ce3db3d Replace <OBJECT_DIR> rule placeholder consistently (#14667)