[Cmake] Set a variable to a list of filenames that match a pa ttern

Bitter, Ingmar (NIH/CC/DRD) IBitter at cc . nih . gov
Thu, 31 Jul 2003 07:56:37 -0400


Hi,

I would love to use the FILE() command as well.
(1) how do I specify that I want *.C and *.cpp and *.cxx and *.h
(2) how do I make it work at all (i.e. my version 1.6.7 of cmake does not
know the FILE() command :-(

-Ingmar 

-----Original Message-----
From: Andy Cedilnik [mailto:andy . cedilnik at kitware . com] 
Sent: Wednesday, July 23, 2003 11:42 AM
To: Karr, David
Cc: cmake at www . cmake . org
Subject: RE: [Cmake] Set a variable to a list of filenames that match a
pattern

Hi David,

Without specifying the directory, it will pick your current source
directory. So,

FILE(GLOB var "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") 

and 

FILE(GLOB var "*.cxx") 

is the same.

I just do not think it is a good think to refer to things relatively.
So, you better use full path to things.

Why would you need relative paths anyway?

				Andy

On Wed, 2003-07-23 at 11:34, Karr, David wrote:
> It would be slightly better for my purposes if there were a
> way to use this *without* inserting the .../foo/ in front of
> every file name; that way I wouldn't have to run CMake every 
> time I made a temporary copy of my project under a new directory,
> but only when the actual contents of the build changed.
> Would it be possible to support a syntax like this:
> 
>   FILE(GLOB_RECURSE var "*.cxx")
> 
> which implies that the recursive search starts in
> ${CMAKE_CURRENT_SOURCE_DIR} but that the output names the files
> using their paths relative to ${CMAKE_CURRENT_SOURCE_DIR} 
> instead of absolute paths; the result would be
> 
>   var = a.cxx b.cxx bar/c.cxx bar/d.cxx
> 
> 
> Also, I wonder if I could write:
> 
>   FILE(GLOB var2 "bar/*.cxx")
> 
> with the result that
> 
>   var2 = bar/c.cxx bar/d.cxx
> 
> This is useful to me because I want to do some things with 
> the files foo/bar/*.cxx that I don't do with the files 
> foo/*.cxx, for example I want to put them in their own
> source group (this apparently requires an extension to
> to SOURCE_GROUP, but I discussed this in a different message).
> 
> 
> I suspect the implementation of these features could be
> lifted from my hack to cmSetCommand.cxx, with appropriate
> changes to use the newer "glob" function.  For that matter
> it was a very easy thing to add in the first place, at 
> least in the way I tried it.


_______________________________________________
Cmake mailing list
Cmake at www . cmake . org
http://www . cmake . org/mailman/listinfo/cmake