Set BOOST_CPPFLAGS and THREADFLAGS globally

Should fix #1523