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

kitts kitts.mailinglists at gmail.com
Mon Jan 29 12:29:50 EST 2007


On Monday 29 Jan 2007 IST, Radu Serban wrote:
> 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.

Its that simple? :-) I'll try it soon as i get to work. I forgot to mention 
one more thing. Id like to know even update the 'INCLUDE_DIRECTORIES()'.

Maybe ill set a cached variable, update it with the full path names of the 
directories to include and then update that in the parent CMakeLists.txt 
with INCLUDE_DIRECTORIES(${ARCH_INCLUDE_DIRS}).

Thanks!
-- 
Cheers!
kitts


More information about the CMake mailing list