I've a directory and different subfolders, like this:
home
|
|-library1
|-library2
|
|-libraryn
Every subfolder contains a complete library that can compile by itself (every library has a different mantainer). In every subfolder there's a CMakeLists.txt
that allows to compile the project.
I want to find a way to create a CMakeLists.txt
on home folder, that calls compilation of every project, so after this I can simply call make
on home folder (or wherever I call cmake) in order to have all libraries ready at once.
I'd like to avoid to put in CMakeLists.txt
manually every project folder, because they are a lot.
How can I do it?
EDIT:
Simply using add_subdirectory
does not work: as I've said, these are indipendent project. Some of them have same targets (like Example, doc etc) and when I add them with this command cmake returns an error saying that different CMakeFiles.txt's cannot have same targets. I'd like something like
for every folder
create build/projec folder
cd into that folder
call cmake for specific folder project.
Maybe it's more simple using a bash script, but I'd like to use cmake in order to compile these libraries also on other platforms rather than Linux.