[CMake] file (GLOB) on linux with CMake 2.8

Seelan Vamatheva Seelan.Vamatheva at Starz.com
Mon Mar 1 15:03:06 EST 2010


I do know about the reason for manually adding the source files.

But has no one else come across this 'bug' on linux?  I'll file a bug report.

Thanks.


-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Michael Wild
Sent: Monday, March 01, 2010 2:50 PM
To: Ryan Pavlik
Cc: cmake at cmake.org
Subject: Re: [CMake] file (GLOB) on linux with CMake 2.8


On 1. Mar, 2010, at 19:05 , Ryan Pavlik wrote:

> 
>>> your directory to get a list of files, and do a "set(SOURCES)" command
>>> and paste your file list in, or some similar technique.
>>> 
>>> See this link for some info on why:
>>> http://www.cmake.org/cmake/help/cmake2.6docs.html#command:aux_source_directory
>>>     
>> Your technique (use ls) is no better than file(GLOB) because either way
>> the logic is only run at CMake configure time which leads to CMake not
>> knowing when it needs to regenerate your build files.
>> 
>> The best practice (which I heartily recommend) is to hardcode the list
>> of files into your CMakeLists.txt.
>> 
>> tyler
>>   
> I meant to use "ls" when writing the cmakelists.txt file, not to have cmake itself run ls.  It's a "lazy coder" trick; running this command in a terminal :
> ls *.cpp *.c *.h | sort
> 
> provides something I can copy and paste into my cmakelists.txt file, and update as I add new files.
> 
> Ryan
> 

In vim:

:r !ls *.cpp *.c *.h | sort


;-)

Michael

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list