[Cmake] out of source builds

David Somers dsomers at trevezel.com
Tue Aug 3 15:33:29 EDT 2004


Brad said:
> If there are intermediate outputs between each command you can chain
> together the custom commands by having each list the output of the
> previous command as a dependency.  That way the minimal amount of
> rebuilding will occur when something goes out of date.

Sure, but...

In MSVC, I have a custom build which does the following (and is dependent
upon the three files$(InputDir)/doc/fonts.style, $(InputDir)/doc/page.style,
$(InputDir)/doc/cxref.style) and simply outputs $(InputDir)\latex-style.c:

echo /** The style files needed for LaTeX. **/ >  $(InputDir)\latex-style.c
echo.                                          >> $(InputDir)\latex-style.c
echo /*+ The fonts style file as a string. +*/ >> $(InputDir)\latex-style.c
echo char *latex_fonts_style=                  >> $(InputDir)\latex-style.c
sed "s/\\/\\\\/g" $(InputDir)/doc/fonts.style | gawk
"{print\"\\\"\"$0\"\\n\\\"\"}" >> $(InputDir)\latex-style.c
echo ;                                         >> $(InputDir)\latex-style.c
echo.                                          >> $(InputDir)\latex-style.c
echo /*+ The page style file as a string. +*/  >> $(InputDir)\latex-style.c
echo char *latex_page_style=                   >> $(InputDir)\latex-style.c
sed "s/\tCONFIG-ONLY PAGE=A4//g" $(InputDir)/doc/page.style |grep -v
CONFIG-ONLY | sed "s/\\/\\\\/g" | gawk "{print\"\\\"\"$0\"\\n\\\"\"}" >>
$(InputDir)\latex-style.c
echo ;                                         >> $(InputDir)\latex-style.c
echo.                                          >> $(InputDir)\latex-style.c
echo /*+ The cxref style file as a string. +*/ >> $(InputDir)\latex-style.c
echo char *latex_cxref_style=                  >> $(InputDir)\latex-style.c
sed "s/\\/\\\\/g" $(InputDir)/doc/cxref.style | gawk
"{print\"\\\"\"$0\"\\n\\\"\"}" >> $(InputDir)\latex-style.c
echo ;                                         >> $(InputDir)\latex-style.c
echo Created $(InputDir)\latex-style.c

Trying to put all those commands in as a chain of custom build statements
seems overkill... so the ability to have a custom command run a series of
commands would be ideal :-) So as I previously said, I think the only way to
do this in cmake would be to get the custom command to call a batch file to
do all the above.

Cheers,

David



More information about the Cmake mailing list