Skip to content

"cmake -E rm *.h" command fails on Windows

The command works on Linux and FreeBSD but not on Windows:

Linux

$ uname -a
Linux PUMBA 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
$ cmake --version
cmake version 3.27.4

$ cmake -E rm *.h   # OK. All *.h files are deleted

FreeBSD

% uname -a
FreeBSD simba 13.3-RELEASE-p1 FreeBSD 13.3-RELEASE-p1 GENERIC amd64
% cmake --version
cmake version 3.28.3

% cmake -E rm *.h   # OK. All *.h files are deleted

Windows

> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631
> cmake --version
cmake version 3.29.2

> cmake -E rm *.h   rem # FAILURE: none of the existing *.h files have been deleted
CMake Error: File to remove does not exist and force is not set: *.h
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information