[CMake] Re: How to update a variable inside a subfolder?

Radu Serban radu at llnl.gov
Mon Jan 29 12:14:49 EST 2007


kitts wrote:
> # Here I would like SRC_LST to be updated inside the subdir, however,
> # SRC_LST has the complete list in the subdir not changes made are
> # lost as it returns to this parent directory
> ADD_SUBDIRECTORY(${ARCH})
> 
> ADD_LIBRARY(MyLib ${SRC_LST})
> 
> The file Source/x86/CMakeLists.txt only contains:
> 
> SET(SRC_LIST ${SRC_LIST} arch.c init.S startup.S)
> 
> I don't want to include these files directly in Source/CMakeLists.txt as
> file names and the number of them varies from one arch to another. Depending 
> on the complexity, they may further contain subfolders for easier code 
> organization. Maintainers of the arch specific are different for each arch 
> and id like to let them take responsibility with their folders.
> 
> The only solution I see is a mechanism in the arch subfolders to create a
> file that will contain names of all the source files for that arch and
> then include that file in the parent folder's CMakeLists.txt. But is
> there a cleaner solution?

Make SRC_LST a cached internal variable.

--Radu


More information about the CMake mailing list