Not sure what you wanted to do in the first place, because these configuration commands don’t look right. The BUILD_SHARED_LIBS is a boolean type of variable, and Debug/Release strings are supposed to be used as values for CMAKE_BUILD_TYPE variable (for single-config generators, that is).
If you have BUILD_SHARED_LIBS as an option (cache variable) in your project, then you won’t need to set it inline in CLI for the second time.
And then if your question is whether the second build (Release) will affect the first build (Debug) artifacts, then in general it won’t (but that of course depends on your particular project), unless you don’t have CMAKE_DEBUG_POSTFIX set, because in that case Release binaries will overwrite Debug binaries. Also note that even if you do have it set, in case of executables you will still need to explicitly set the corresponding target property.