[CMake] Checking to see if a filename is of a given file type.

Josef Karthauser joe.karthauser at geomerics.com
Fri Oct 19 11:36:14 EDT 2007


Is there a canonical way of matching a filename against a number of
filetypes?

 

I have a list of files MY_FILES, and I'd like to efficiently extract
those which match a given list of filename extensions, in otherwords
something like this:

 

                SET(ALL_FILES_VAR this.c that.cpp something.h test.dat
readme.txt)

                SET(EXTENSIONS c cpp)

                MATCH_FILES(MATCHED_FILES_VAR ALL_FILES_VAR EXTENSIONS)

                MESSAGE("Should just contain this.c that.cpp :
${MATCHED_FILES_VAR}")

 

The problem I'm trying to solve is, given a list of files, run a
specific custom target generator for all those of a given type.
Something like this:

 

MAKE_TARGETS(HANDLER LIST_OF_FILES EXTENSION_FILTER)  

 

Or explicitly

 

                MAKE_TARGETS(DOXIGEN LIST_OF_FILES "c cpp")

 

or

 

                MAKE_TARGETS(LATEX LIST_OF_FILES "tex tek")

 

Any thought would be very welcomely received.  It maybe I'm trying to
reinvent the wheel here.

 

Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20071019/432e75a3/attachment-0001.html


More information about the CMake mailing list