I have a cmake git repository with a library that I use in many project, named core
.
I've another cmake git repository that includes core
as dependency in a subtree. This project creates a library plot
.
Now I have a new git repository that needs both plot
and core
as dependencies, and I've included them as subtrees as well. Now the structure of my project is:
myproject
|
|-Thirdparty-subtrees
|
|-core
|-plot
|
|-Thirdparty-subtrees
|
|-core
Now when I want to build myproject
with cmake it tells me that I've two project with the same name core
, because the project is defined twice.
I can remove the first-level core
subtree, but then it will became an hidden dependency, and if for some reason plot
will erase the core
subtree, I will have problems. I'd like to maintain the explicit dependency in the first level subtree folder.
So I'd like to know how can I check with CMake is two targets with the same name exists, and in this case notify it with a message and build only one project discarding the other (I suppose that if two targets have the same name, they are the same project).
How can I build core
correctly only once?