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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Dec 1 15:28:11 EST 2008


Second try.

Surely somebody here knows why VERBATIM fails to work properly (inserts
unwanted double quotes in the command) for certain kinds of stderr and
stdout redirection but not for the basic kind?

If/when there is a fix in the cvs version of CMake, I would be happy to test
it.

Alan

---------- Forwarded message ----------
Date: Sat, 29 Nov 2008 21:08:22 -0800 (PST)
From: Alan W. Irwin <irwin at beluga.phys.uvic.ca>
To: cmake at cmake.org
Subject: [CMake] Getting rid of unwanted quotes that CMake inserts into commands

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
__________________________
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list