I'm using CMake and I need to specify specific compiler flags in a project which uses C and some C++.

I am currently adding:

set(CMAKE_C_FLAGS "-std=c99 -fsanitize=address -fno-omit-frame-pointer -g")
set(CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g")
into my CMakeLists.txt. However, this doesn't seem to be working because address sanitizer is still not linked into my binaries... I looked at the makefiles generated by CMake and "fsanitize=address" is no where to be found in them, so perhaps this is why.

In any event, what is the proper way to actually get CMake to successfully pass flags to the compilers? Thank you.