0

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?

Jepessen
  • 11,744
  • 14
  • 82
  • 149
  • Possible duplicate of [How to handle a transitive dependency conflict using Git submodules and CMake?](https://stackoverflow.com/questions/42978414/how-to-handle-a-transitive-dependency-conflict-using-git-submodules-and-cmake) – Tsyvarev Mar 19 '18 at 08:16

1 Answers1

0

As much as it may look like one, Git is not meant to be used as a dependency management tool. You are most likely better off using a different tool for this purpose.

jsageryd
  • 4,234
  • 21
  • 34