[CMake] How to make FILE() append to the list of files?

Robert Dailey rcdailey at gmail.com
Thu Nov 27 01:12:16 EST 2008


On Wed, Nov 26, 2008 at 7:27 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> Robert Dailey wrote:
>
>> Hi,
>>
>> I have about 20 directories that contain source files. However, the FILE()
>> call I make to each directory will have a different glob expression. I need
>> to be able to do FILE( GLOB ..... ) about 20 times and each time have it
>> append to the existing variable I give it. Is this possible? What would be
>> the recommended way of accumulating a list of files in all 20 directories?
>>
>>
> find . -name "*.c" > source_files.txt
> edit source_files.txt and put that list of files exiplicitly into a
> CMakeLists.txt file.
>
> file(GLOB is a bad way to get source lists for CMake.   CMake has no way of
> knowing when new files have been put in the directory.


But unless I am missing a fundamental feature somewhere, GLOB still seems to
be the better alternative. While it may not intrinsically know when new
files have appeared on the filesystem, the programmer can simply re-run the
CMake command to get an updated project with the newly added source files
without editing the CMakeLists.txt file directly. This is better than the
alternative, which is a hard-coded list of project files in the CMake
script.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081127/584d9e8c/attachment-0001.htm>


More information about the CMake mailing list