[CMake] Converting xml-Files during build

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Aug 18 11:16:17 EDT 2008


On 2008-08-18 14:24+0200 Timo Penndorf wrote:

> Now my question is, how can I create such a build rule with cmake.
>
> I tried (with 'cp' just to get it work...)
>
>
> ADD_CUSTOM_COMMAND(OUTPUT $(CMAKE_BUILD_DIR)/file.xmlt
>                   COMMAND cp ${CMAKE_SOURCE_DIR}/file.xmlt
>                              $(CMAKE_BUILD_DIR)/file.xmls
>                   MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/file.xmlt
>                   COMMENT "Create xml file")
>
> but it does not work.

The above sets up a custom command, but to get it to actually run at make
time, you need a custom_target that depends on the output file, e.g.,

add_custom_target(target_name ALL DEPENDS $(CMAKE_BUILD_DIR)/file.xmlt)

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list