Only add platform flags for targets that generate an actual binary. Fixes #346.