[CMake] ADD_TEST and need of other files

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Nov 22 10:40:14 EST 2007


On 2007-11-22 10:11+0200 Salvatore Iovene wrote:

> Hi,
> I add a test that needs to load a certain xml file and process its
> content. The xml file is in the same directory as the test sources, in
> the source tree. How can I install this xml file so that it will be
> available in the binary tree, in the same directory as the test
> executable?

First, is it really necessary?  For many programmes you can specify an input
file with an absolute path (e.g., ${CMAKE_CURRENT_SOURCE_DIR}/test.xml) so
normally there is no need to copy an input file from the source tree to the
build tree.

Second, if it is really necessary in this case, then you can
CONFIGURE_FILE with the COPYONLY attribute at "cmake" time or execute

cmake -E copy_if_different

at either "cmake" or "make" time.

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