[CMake] append command

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Aug 11 13:39:08 EDT 2011


On 2011-08-11 17:20+0200 Michael Wild wrote:

> How about
>
> string(APPEND " /newstuff" xyz)
>
> It is not satisfactory in that it doesn't follow the semantics of all
> the other string(...) commands which never modify their input.

I like that idea, but I would generalize it as

string(APPEND <string> <output_variable> <input> [<input>...])

to make it similar to other string commands.

BUT if no input is given take it from "${output_variable}" just as
for your suggestion.

I would also make that same change for all other string commands of
the same form, i.e., the various REGEX and REPLACE commands.  For those, I
find the input string is often "${output_variable}" so I believe this
generalization would be a useful convenience for all users of those
string subcommands.  Furthermore, even though this generalization of
REGEX et all is a major change, IIRC you get a wrong number
of arguments now for, e.g.,

string(REGEX REPLACE <regular_expression> <replace_expression> <output
variable>)

so I believe this generalization would be backwards compatible.

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