fixed a bug and support C++11

changed wrong variable name CXXFLAGS to BUILD_CXXFLAGS