Good day! The problem is the following, in gusto I divide the project into subprojects, so that in the root gang there is only add_directory (dir1) add_directory (dir2). When compiling (in order - the first directory) - complains about the unresolved links to the classes of the second directory, if you swap the order of compilation - the second folder will complain that it does not know the links to the first.

The question arose - how can a project be divided in general, and how can unresolved links be avoided? The variant works - when in the root gusb the first folder is connected not by the pop-project, but simply the files from it are listed in add_executable and the sub-project is only the second folder. But you only need add_directories in the root.

  • And what is the subprojects? Static libraries? Dynamic? What compiler? It seems to me cmake nothing to do with it. Yes, of course, cmake subprojects may depend on other projects, but without cyclic dependencies, of course - zenden2k
  • no, just add_directory, not libraries - Mira

1 answer 1

There should be no cross-references between projects. Otherwise, how can they be assembled, if for the assembly of one, is it necessary that the other be assembled and vice versa? Select the common code into the library, which you link to both projects so that they depend on the library and are not dependent on each other.

  • Thank you so much for the answer! It was just that they convinced me that it was impossible to do cross-overs, and there should be no problems with subprojects (and go get mana). - Mira