Filter duplicate prefixes in register_program

Without a filter, certain combinations add $CXXFLAGS multiple times.