overwriting CMAKE_CXX_FLAGS

My environment has CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types. For debugging purposes I don’t want to use these settings. In my CMakeLists.txt I tried set(CMAKE_CXX_FLAGS ""). However when I rebuild my makefiles and recompiled the code, I still could see -O2 -pipe -g -feliminate-unused-debug-types. Why is this happening? I there a way to overwrite CXXFLAGS?

set(ENV{CXXFLAGS} -my -flags)

Or you can set the environment variable from outside the build using your system’s shell.