How do I replace the compiler options for one target?

I have a multi-directory project with a lot of CMakeLists.txt files. At the root file I have this:

set(CMAKE_CXX_FLAGS "-Wall -Wimplicit-fallthrough -Werror=return-type")

I’d like to completely replace that in a subdirectory, for a certain target. I tried lines 1 or 2 here:

add_executable(foo foo.cc)
set_target_properties(foo PROPERTIES COMPILE_OPTIONS "-g")  # 1
target_compile_options(foo PRIVATE "-g")                    # 2

Both of those led to a build where the clang++ command has the -g appended to the previous flags. How to I replace, not append, to the flags? Am I not setting them in the right way to begin with?

thanks,
Rob