I have found the way to configure according to Andre's comment in How to change a compiler flag for just one executable in CMake? .
For example, I add a flag for bubble.c:
set_source_files_properties( ${ProjDirPath}/../bubble.c PROPERTIES COMPILE_FLAGS "-O2")
It worked.But I can't specify the flag for debug or release. Dose anyone know how to configure it? Thank you!