_deps folder requires administrator priviledges to delete

I have recently started using FetchContent to manage some dependencies in my CMake project and for some reason the _deps folder needs administrator priviledges to delete despite not needing them to make the folder in the first place.

Anyone know how to disable this behaviour?

The _deps directory won’t be made that way by CMake itself. If you’re seeing that, I suspect you’re running some steps with administrative privileges, such as sudo make install. If you are going to run any command with admin privileges, make sure your build is already fully up-to-date first, otherwise you’re going to run into the sort of problems you’ve described.

I don’t think I am doing anything with elevated permissions, not unless there is some funky windows things going on. I am just running PowerShell via windows terminal (not developer powershell).

I can consistently run:
cmake -B ./build
and then
rm -r ./build
and get the error:

Remove-Item: You do not have sufficient access rights to perform this operation or the item is hidden, system, or read only.
Remove-Item: You do not have sufficient access rights to perform this operation or the item is hidden, system, or read only.
Remove-Item: You do not have sufficient access rights to perform this operation or the item is hidden, system, or read only.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build\_deps\godot-cpp-src\.git\objects\pack cannot be removed because it is not empty.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build\_deps\godot-cpp-src\.git\objects cannot be removed because it is not empty.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build\_deps\godot-cpp-src\.git cannot be removed because it is not empty.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build\_deps\godot-cpp-src cannot be removed because it is not empty.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build\_deps cannot be removed because it is not empty.
Remove-Item: Directory C:\Godot\Extensions\GDExtension-Template\build cannot be removed because it is not empty.

I will do some deeper diving to see if there is some Windows shenanigans going on

Wha CMake version are you using? If you use an older CMake version, do you still see the same behavior?

Do you have a virus checker running and if so, can you exclude the build directory from the directories it scans?

Do you have a virus checker running

Ah, that could be it, I will check Windows defender settings

So I tried setting an exception for the build folder and I still get the same issue. Interestingly this isn’t an issue in the Windows file explorer, I can delete it there without being asked for Admin permission. But still persists in Terminal and IDEs/text editors like CLion/VScode