[Cmake] howto add *.cpp sources

Andy Cedilnik andy . cedilnik at kitware . com
29 Jul 2003 10:49:23 -0400


Hi Jan,

It will be possible in CMake 1.8 (or in 1.7). There was a command added
called FILE. This command does a whole bunch of things, such as reading
and writing files, make directories, and globbing.

Here is how you would do it:

FILE(GLOB SRC "${CMAKE_CURRENT_SOURCE_DIR/*.cpp")
FILE(GLOB HEADER "${CMAKE_CURRENT_SOURCE_DIR/*.hh")

That said, this is not recomendend way of doing things because of
reasons described in one of the previous e-mails from Bill Hoffman. The
main reason is that when you add new sources, cmake will not update
makefiles.

			Andy

On Tue, 2003-07-29 at 10:40, Jan Woetzel wrote:
> Hi,
> 
> is it possible to add all wildcard *.cpp matching files in a directory 
> to a variable?
> 
> I want to add all *.cpp files to a variable SRC and all headers *.hh to 
> HEADER.
> 
> I think it was discussed before but couldn't find it.
> 
> Thanks,
> Jan.