[CMake] Variable Propagation

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jun 21 14:57:53 EDT 2010


On Sunday 13 June 2010, C. Meissa wrote:
> Hello list,
>
> A varible ${var1} can be accessed in any subdirectory’s
> CMakeLists.txt.
> However, if those files change ${var1} these changes are not
> accessible from the directory above.
>
> Is there any possibility of getting this done, anyway?
> I need to provide easy adding for source files to the developers,
> So it would be nice to just have a CMakelists.txt in every subfolder,
> which then edits the source-variable.

What I did once in such a case was to put files named "SourceFiles.txt" in 
every directory with source files, which just had a set() command for the 
source files, and this file was then include()d by the respective 
CMakeLists.txt.
This way the other developers didn't have to edit the actual CMakeLists.txt, 
but only these files which were *very* simple.

Alex


More information about the CMake mailing list