[CMake] cmp0026, file(GENERATE...), and configure_file

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Apr 16 16:34:21 EDT 2015


I am trying to change the existing PLplot build system to set CMP0026
to new following the existing advice that file(GENERATE...) should be
used to configure target locations in a file using generator
expressions.  But the issue is configure_file currently (see end
question below) does not appear to honor generator expressions, but
it is still needed to configure @...@ expressions.

So is it recommended that a two-step procedure be used to configure
a file?  For example:

# Deal with @...@ configurable items:
   configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/pkgIndex.tcl.in
     ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl_at_configured
     @ONLY
     )

# Deal with items configured with generator expressions:
   file(GENERATE
     OUTPUT
     ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl
     INPUT
     ${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl_at_configured
     )

The above idea appears to work although it then exposes a config-time
versus generate-time issue where
${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl needs to be concatenated with
other files in order to install a concatenated result.  I think I can
work those other issues out by doing that concatenation at make time
or install time (as opposed to cmake time), but can someone confirm
the above method is the best way (and perhaps the only way right now?)
to configure a file with both @...@ configurable items and generator
expressions?

@Cmake developers:

If the above complications for configured files are the only way to
deal with a mixture of @...@ items and generator expressions to
configure, could a change to configure_file so that it honors
generator expressions be implemented to avoid these complications?

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
__________________________


More information about the CMake mailing list