combine cmakelist

I have a root directroy with a list of projects in subfolder and a cmakelist.txt file with some code, then in the subfolder their are more folders and a cmakelist.txt, then in the subfolder i have a project file and its cmakelist.txt, i want to combine them so that i many only have all the details of the last project in the subfolder and all the dependency detail should be availible in that as well.

I don’t think it’s completely clear what you’re asking here. Can you provide an example of what you have now and annotate it with what you want it to look like?