# Function to remove -Werror and -Werror-* flags from a flags variable function(remove_werror_flags FLAGS_VAR) # Get the current value of the flags variable set(_flags "${${FLAGS_VAR}}") # Split into a list to process each flag separate_arguments(_flags) # Filter out -Werror and -Werror-* flags set(_filtered_flags "") foreach(flag ${_flags}) if(NOT "${flag}" MATCHES "^-Werror($|[= ].*)") list(APPEND _filtered_flags "${flag}") endif() endforeach() # Convert back to a space-separated string string(REPLACE ";" " " _filtered_flags "${_filtered_flags}") # Update the parent scope variable set(${FLAGS_VAR} "${_filtered_flags}" PARENT_SCOPE) endfunction()