Skip to content

file: Change REMOVE to ignore empty names

Brad King requested to merge brad.king/cmake:file-remove-no-empty into master

Previously code like

file(REMOVE_RECURSE "${accidentally_missing_variable}")

treated the empty string as a relative path with respect to the current directory and removed its contents. Change this behavior to ignore the empty string with a warning instead.

Normally such behavior changes are done with a policy, but in this case such code is likely a real bug in project code that can delete data.

Fixes: #19274 (closed)

Merge request reports