re-implement check_cxx_compiler_flag to work properly in cmake 2.6