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

Tyler Roscoe tyler at cryptio.net
Mon Mar 1 12:40:23 EST 2010


On Mon, Mar 01, 2010 at 09:21:36AM -0600, Ryan Pavlik wrote:
> any case, you probably don't want to do this.  Instead, do an "ls" in 

Agree with this.

> 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


More information about the CMake mailing list