[CMake] Getting cmake to apply patches
Hugh Sorby
h.sorby at auckland.ac.nz
Tue Nov 24 21:00:58 EST 2009
Thanks David,
Following your advice I did the following:
SET( PATCH_BATCH_FILE patch_wrap.bat )
FILE( WRITE ${PATCH_BATCH_FILE} "${PATCH_EXECUTABLE} -p0 -i
${LIB_DIR}.patch" )
EXECUTE_PROCESS( COMMAND cmake -E chdir ${PROJECT_SOURCE_DIR}
${PATCH_BATCH_FILE}
RESULT_VARIABLE RESULT_PATCH )
MESSAGE( STATUS "Patch result: ${RESULT_PATCH}, PROF SOURCE DIR:
${PROJECT_SOURCE_DIR}" )
FILE( REMOVE ${PATCH_BATCH_FILE} )
This worked (add in your own Windows checks)
David Cole wrote:
> For now, another workaround would be to write a script that calls
> patch with the -i argument and then invoke the script with
> execute_process or a different cmake -E command line...
>
>
> On Tue, Nov 24, 2009 at 7:43 PM, Hugh Sorby <h.sorby at auckland.ac.nz
> <mailto:h.sorby at auckland.ac.nz>> wrote:
>
> Thanks Alan,
>
> I will attempt to:
>
> 1) search the CMake bug tracker (not very good at this most never
> seem to find anything relevant)
> 2) add new bug if 1) fails to bear any fruit.
>
> Unfortunately the
>
>
> cmake -E chdir netgen patch -p0 < netgen-4.9.11.patch
>
> doesn't work so well on Windows Vista which is why I was trying to
> use the -i option.
>
>
>
> Alan W. Irwin wrote:
>
> On 2009-11-25 11:00+1200 Hugh Sorby wrote:
>
> Sorry about that missed a chdir should be
>
> cmake -E chdir netgen patch -p0 -i netgen-4.9.11.patch
>
>
> I confirm that you have found a bug (at least with Debian
> stable Linux and a
> bootstrapped cmake version 2.8.0-rc6). Here is a simple
> demonstration
> with "ls -i".
>
> software at raven> ls -i config.h
> 4539478 config.h
>
> software at raven> cmake -E chdir . ls -i config.h
> config.h
>
> In other words the ls -i option is consumed by CMake just like
> the patch -i
> option is consumed for you. Note that -i is an
> option for CMake itself (wizard mode) so there is probably
> some screwup
> in interpretation of the command line when cmake -E is being run.
> If I change the flag from -i to -l, then the flag is not
> consumed and
> you get the same results for
>
> "ls -l config.h" and "cmake -E chdir . ls -l config.h".
> That's consistent
> with the idea that you will only have trouble with cmake
> consuming the
> option when it is an option it recognizes. ("-l" is not a
> cmake command
> option while "-i" is).
>
> I also confirm the bug occurs for cmake-2.6.0 (the Debian
> stable system
> version) which makes it a bug that has been around for quite a
> while. I
> suggest you go ahead and put it in the bugtracker (if you
> cannot find
> another report about the same issue there).
>
> Until this cmake -E option consuming bug is fixed I suggest
> you could avoid
> the -i option with patch by using, e.g.,
>
> cmake -E chdir netgen patch -p0 <netgen-4.9.11.patch
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics
> and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca
> <http://astrowww.phys.uvic.ca>).
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation
> for stellar interiors (freeeos.sf.net
> <http://freeeos.sf.net>); PLplot scientific plotting software
> package (plplot.org <http://plplot.org>); the libLASi project
> (unifont.org/lasi <http://unifont.org/lasi>); the Loads of
> Linux Links project (loll.sf.net <http://loll.sf.net>); and
> the Linux Brochure Project
> (lbproject.sf.net <http://lbproject.sf.net>).
> __________________________
>
> Linux-powered Science
> __________________________
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
>
More information about the CMake
mailing list