MantisBT - CMake
View Issue Details
0015244CMakeCMakepublic2014-11-11 19:212016-06-10 14:31
Daniele E. Domenichelli 
Kitware Robot 
lowfeatureN/A
closedmoved 
 
 
0015244: Add "cmake -E patch" command line option and "file(PATCH)" command
The ExternalProject module accepts a "PATCH_COMMAND" argument to apply a patch to a project. In another scenario, one would like be to able to apply a patch to a downloaded file. Unfortunately neither of these goal can be achieved easily in a portable way.

- The "patch" command is usually not available on windows.
- "git apply", "hg import", etc work on every platform, but only work for git, mercurial repositories, etc. and don't work for downloaded archives and files.


It would be nice to have a command line option like "cmake -E patch" to apply a patch, that accepts the most commonly used options of the "patch" command (at least -p, -l, -R, and -i). This would ensure that the "PATCH_COMMAND" will work on every platform.


The "file" command could have a new PATCH argument that accepts(at least) an input file, the working directory, a STRIP argument (-p1), an IGNORE_WHITESPACE, and a REVERSE option. The signature could be something like this:
   file(PATCH filename working_dir
        [STRIP levels]
        [IGNORE_WHITESPACE]
        [REVERSE])
This could be used to patch a file after downloading it with "file(DOWNLOAD)"
No tags attached.
Issue History
2014-11-11 19:21Daniele E. DomenichelliNew Issue
2014-11-12 01:32Rolf Eike BeerNote Added: 0037189
2014-11-12 19:36Daniele E. DomenichelliNote Added: 0037202
2014-11-13 08:55Nils GladitzNote Added: 0037206
2016-06-10 14:29Kitware RobotNote Added: 0042665
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0037189)
Rolf Eike Beer   
2014-11-12 01:32   
IIRC we already discussed that a while back and the problem was a BSD-licensed patch implementation that was powerful enough. OTOH "git apply" does not need a repository to work, this is "git am".
(0037202)
Daniele E. Domenichelli   
2014-11-12 19:36   
I didn't know that git apply can be used outside a repository, that's very good to know!

Sorry if it was already discussed, but I couldn't find anything on the bug trackers and on the mailing list archives... ("patch" is not a lucky keyword for this kind of search :-) ). Can you point me to the relative thread(s)?

Anyway, I searched for a BSD patch library and I found only this one:

  https://code.google.com/p/dtl-cpp/ [^]

I don't know if it is powerful enough and if it was mentioned before, though.
(0037206)
Nils Gladitz   
2014-11-13 08:55   
Link to previous discussion on the cmake mailing list:
http://public.kitware.com/pipermail/cmake/2014-January/thread.html#56752 [^]
(0042665)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.