0

I have a project with the actual structure, where Components are subdirectories :

CMakeList.txt
|
---Component1/CMakeList.txt
|
---Component2/CMakeList.txt
|
---Component3/CMakeList.txt

Component2 relies on many libraries from Component1. Component3 relies on many libraries from Component1 and Component2.

In many months, my project want to separate Component1, Component2 and Component3 in 3 differents git repositories. So i created 2 packages : component1.cmake and component2.cmake.

But now, with the findPackage solution, my actual structure doesn't work anymore. During compilation, the configuration failed because Component1 and Component2 haven't been built. (It works if i compile the components manually one after the other).

My main CMakeLists.txt look like this :

project(my_project)
add_subdirectory(Component1)
add_subdirectory(Component2)
add_subdirectory(Component3)

And after i use findPackage in Component2 and Component3 to use the libraries.

Is there a solution for this issue by keeping the add_subdirectory rather than using include ? Maybe is there a solution to compile components (which are subdirectories and not targets) one after the other?

Sedji Aka
  • 217
  • 2
  • 10

0 Answers0