autogen project doesn't use dependencies from add_dependencies
Hi there,
There are two projects in my solution: First and Second and the Second one depends on the First. The First project generates some resource files that are then used by the second project. In order to handle that, my Second project has add_dependencies(Second First) line.
It works fine and I see that the Second project depends on the First one in both MSVC and Xcode. The Second project is actually based on Qt and includes the First project's output via Qt resources .qrc file. Also the Second project has AUTOMOC property enabled, so cmake creates Second_autogen project, but it doesn't depend on the First project and the build order sometimes happens to be the following:
- Second_autogen
- First
- Second
What happens next is that Second_autogen project reads the qrc-file, containing files that are created by the First project which is not yet processed. Here I get error from rcc about the missed file.
So far it happens only in TeamCity Xcode builds, so maybe it is their issue, but I believe the root problem is in dependencies.
The real solution is bigger and the Second project also depends on other projects, but all the other dependencies are done with target_link_libraries() and Second_autogen project depends on all those other projects, but not on the one which is added via add_dependencies().
I am quite new to cmake, so maybe I am missing something, but I believe if autogen project depends on all the target_link_libraries() projects, it also needs to depend on add_dependencies() ones.
Cheers!