On 2013-01-08 10:47+0100 Eric Noulard wrote:

2013/1/8 Alan W. Irwin <ir...@beluga.phys.uvic.ca>:

The rule should be simple as:

You need to escape one time less than the number of cmake run occuring
through the workflow path.
In your case you have to escape once because install(CODE ...) is
processed **by cmake**
at "Install time" and you expect the evaluation to take place at that time.

The may-be tricky part is "when" cmake (or derived cmake script engine
is running)
the "running time" of cmake tool suite may not be obvious and I tried
to picture it in
a tutorial (see excerpt attached to this mail)

May be we can document common uses cases:

install(CODE  --> one escape
install(SCRIPT --> none

add_custom_command/target --> one or two level escape depending on the arguments

with various combination where you may "configure_file"
 1) yourself  before using "install(SCRIPT ..." --> my way of work
       usually one escape level.

 2) through CPack like values used in CPACK_xxx variable which end up
      in some CPack template file which are processed first  at CMake-time and
      may be again at CPack-time. This one may lead to 2 level escape.


Don't forget the example of code like this:

set(CPACK_SOURCE_IGNORE_FILES
  "\\\\#*\\\\#$"
  "^${PROJECT_SOURCE_DIR}.*/\\\\.svn/"
  ....

I have been wrong about overcomplicating escapes in the past, but I
think it this case, 4 levels of escapes are really necessary for these
particular regex expressions.  Anyhow, I know this code works, but I
don't know why!  Does your simple rule above explain this, and if so how?

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); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); 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
__________________________
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to