[CMake] Getting rid of unwanted quotes that CMake inserts into commands

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Nov 30 00:08:22 EST 2008


I have defined the following custom command:

add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grid_EOS1_2.out
   COMMAND ${free_eos_test_LOCATION} < ${CMAKE_CURRENT_BINARY_DIR}/grid_EOS1_2.in >& ${CMAKE_CURRENT_BINARY_DIR}/grid_EOS1_2.out
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/grid_EOS1_2.in free_eos_test
   VERBATIM
   )

The COMMAND line will get wrapped in this e-mail, but it appears all in one
line in the CMakeLists.txt file.

For both 2.6.1 and 2.6.2, the resulting command that is executed is fine
except that >& is transformed to ">&" and those inserted double quotes
interfere with the desired redirection. If I use > instead (which makes
stderr default to the terminal rather than mixing it in with grid_EOS1_2.out
like I would like), then there are no double quotes surrounding that in the
generated command.  If I use 2> and 1> redirection to generate two files
(one for stderr, one for stdout), they are transformed to "2>" and "1>" by
CMake and those inserted double quotes again interfere with the desired
redirection.

Is this a CMake bug (since double quotes are being inserted into the
generated command for >&, 2>, and 1> despite the VERBATIM above)?

Regardless of that bug question, is there a way to work around this CMake
issue?

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