[CMake] patch on Windows
Nils Gladitz
nilsgladitz at gmail.com
Sun Jan 12 03:50:13 EST 2014
On 12.01.2014 01:39, Rob McDonald wrote:
> Where does CMake get its patch implementation?
As far as I know CMake does not have a patch implementation.
>
> I'm using a patch step with ExternalProject_Add on Windows (and other
> platforms).
>
> I had it working on one Windows machine - which unfortunately just got
> knocked off a desk and will never be recovered. The same files on a
> different Windows machine doesn't work.
>
> 'patch' is not recognized as an internal or external command.
>
> Looks like CMake can't find 'patch', but I thought it was built-in. I
> was using 2.8.8, but when I ran into this, I upgraded to 2.8.12.1 --
> no change.
I think if your PATCH_COMMAND literally contained "patch" (without path)
the only way it was working before is that it was somewhere in your PATH
environment.
> Is there a FindPATCH.cmake I need to use? For Windows patching, am I
> better off just carrying new copies of the changed files and copying
> them over in the patch step?
I don't think cmake provides a FindPATCH.cmake but there wouldn't be one
to be found per default on a standard windows installation either.
The PATCH_COMMAND can be anything. For something portable I'd try to
stick to "${CMAKE_COMMAND} -E" (command mode) or "${CMAKE_COMMAND} -P"
(script mode).
-E provides copy commands while -P would allow you to read and write
files and perform e.g. regular string or regexp substitutions.
Nils
More information about the CMake
mailing list