[CMake] Dependencies to generated file across libraries
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Jan 25 11:56:58 EST 2010
On Monday 25 January 2010, Jens Auer wrote:
> Hi,
>
> I am trying to port a project from VC++ to a cmake build-system.
> Unfortunately, the project has a little problem: There are several
> libraries and some of them generate files using uic (Qt3). Cmake can
> handle this pretty well, but in one case, there are two libraries which
> include generated headers from each other:
> / Project(projectName)
> /lib1
> File1.ui
> (GeneratedHeader1.h)
> Header2.h
> add_library(...)
> /lib2
> File2.ui
> (GeneratedHeader3.h)
> Header4.h
> add_library(...)
>
> The GeneratedHeader1.h and GeneratedHeader3.h are created by QT_WRAP_UI.
> Header2.h includes lib2/GeneratedHeader3.h and Header4.h includes
> lib1/GeneratedHeader1.h. This creates a circular dependency between the
> projects, but it would be possible to just generate the headers before
> processing one project, but cmake seems to not detect such file-based
> dependencies between sub-directories. When I try to build the project,
> the compiler fails to find the missing library. Is there a way to have
> specify the dependency manually? I tried the OBJECT_DEPENDS source file
> property, but this has not changed the build process.
You need to make the libraries depend on some target which depends on the
generated files. So you could use add_custom_target(GENERATE_MY_FILES ... )
which depends on the moc files and then have both libs depend on this one.
Alex
More information about the CMake
mailing list