[CMake] Include all subfolders and files?

Tyler Roscoe tyler at cryptio.net
Mon Oct 5 17:14:10 EDT 2009


On Mon, Oct 05, 2009 at 11:06:19PM +0200, motes motes wrote:
> In a make file I have:
> 
> INCLUDE_DIRECTORIES(${MY_PROJECT}/lib)
> INCLUDE_DIRECTORIES(${MY_PROJECT}/lib/CImg-1.21)
> INCLUDE_DIRECTORIES(${MY_PROJECT}/lib/revised)
> INCLUDE_DIRECTORIES(${MY_PROJECT}/lib/revised/io)
> 
> Is it possible to just specify that everything inside
> ${MY_PROJECT}/lib should be included instead of manullay specifying
> each subfolder?

You could loop over the directories on the filesystem at CMake time and
do it that way, but explicit lists of things are a CMake Best Practice
so that CMake can know when your CMakeLists has changed and regenerate
the build files appropriately.

tyler


More information about the CMake mailing list