[CMake] Undocumented magic required for installing globbed files

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Jan 31 19:24:19 EST 2007


I naively tried to install some globbed files using, e.g.,

install(
CODE
"file(GLOB USER_DOCS ${CMAKE_SOURCE_DIR}/doc/user/html/*) \n
install(FILES ${USER_DOCS} ${docdir}/html/user/html)"
)

But on Debian stable with cmake-2.4.6, "make install" complains with
the following error message:

CMake Error: Error in cmake code at
/home/software/lasi_svn/HEAD/build_dir/cmake_install.cmake:34:
Command INSTALL not scriptable

Can somebody please document which commands are scriptable and which
are not inside the install command?  For example, is it only the install
command that cannot be nested this way?

Now I have looked at other projects and I inferred from them the following
syntax which works:

install(
   CODE "
   file(GLOB USER_DOCS ${CMAKE_SOURCE_DIR}/doc/user/html/*) \n
   file(INSTALL DESTINATION ${docdir}/html/user/html
   TYPE FILE FILES \${USER_DOCS}
   )"
)

However, the file(INSTALL... signature is completely undocumented!

So one burning question is whether this is a leftover from some old release
or something that is really supported for the future that I can rely on.
Furthermore, I have no clue why the $ in ${USER_DOCS} has to be escaped, but
the other "$" within the file commands do not.  So all this seems very much
like magic to me in the absence of documentation.

Could somebody please rectify that lack of documentation for the
"file(INSTALL" signature?

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 Yorick front-end to PLplot (yplot.sf.net); 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