don't pass CXXFLAGS when only linking

This prevents, e.g., warnings thrown by clang for unused arguments.