cpp: filter build options for link and compile stage