Execute patch from Cmake

I run CMake under Windows to download a zipfile with source code and unzip it.
After the unzip I want to execute patches over the directory with unzipped source code. I am taking the zipfile with source code from the Linux end of my project. Under Linux gnu patch is installed, which is used to perform the directory patch. Under Windows gnu patch is not installed and I like to keep it that way.
I am not able to figure out how to execute the patches over the directory using CMake. Is it possible to provide some explanation with an example?

Thank you.

cmake -E patch does not exist, but does have a tracking issue. In the meantime, the usual replacement is git apply after making sure you’re not in a git directory (git --git-dir= apply should do it).

Sorry, but I am new to this Cmake part. Only used it for simple compile and link things. Do you have an example on how to execute ‘git apply’ from a Cmake file?

If you want to run it like a script, execute_process is what you want. If you want it to run at build time, add_custom_command is what to use.