[CMake] Newbie about REGEX

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Feb 11 16:59:41 EST 2007


On 2007-02-11 21:38+0100 Pascal Fleury wrote:

> On Sunday 11 February 2007 17:52:28 Alexander Neundorf wrote:
>> -------- Original-Nachricht --------
>
>>> INSTALL( DIRECTORY . DESTINATION include PATTERN "*/*.h" )
>>> or
>>> INSTALL( DIRECTORY . DESTINATION include REGEX "^.*\\.h$" )
>>>
>> From looking at the man page I'd say you need the EXCLUDE keyword.
>
>
> As I'd like to actually select only the *.h files and copy them, my
> understanding is that I do not need the EXCLUDE keyword. in fact, the manpage
> only says how the pattern is matched, but it does not state if a match will
> actually make it available to the INSTALL command, or ignore it. However, to
> me, the logical things would be to install only those that match.
>
>> From my tests, it is also interesting that if I add the 'EXCLUDE' keyword, it
> *does* exclude all *.h files, but if I remove it, it will match all files....
> I have also tried to exclude most unwanted files, and it works! But that is
> brittle, because the only thing I want to copy is the *.h file.

I just read the man page again out of curiosity, and it is clear from the
example that the rule is everything in the specified directories will be
installed except for what is EXCLUDEd.  So the pattern and/or regex specifies
a certain subset of the files in the directories which are EXCLUDEd or
which have special permissions set.  Nothing else.

>
> Is this a bug in cmake then ?

No.  But there are a lot of alternatives so there is always a way to bend
CMake to your will. :-)

For example, if these header files are not generated, why not simply specify
them explicitly as a list or generate that list implicitly with "FILE(GLOB
....". Then INSTALL that list of files.  Or if the headers are generated files,
then I suggest generating them in their own directory for which you can then
use "INSTALL( DIRECTORY ....") without having to exclude anything.

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