[CMake] Generated files and dependencies

David Cole david.cole at kitware.com
Thu Jun 16 10:52:08 EDT 2011


On Thu, Jun 16, 2011 at 10:00 AM, Łukasz Tasz <lukasz at tasz.eu> wrote:

> Hi all,
>
> I have one issue with organising dependencies between projects.
>
>
> I have three projects,
>   - first is application which contain static code of the application,
>   - second is library which is contain code for the library,
>   - third is library which generates the source code and headers, and
> provide library.
>
> First project is link against static library, and generated library.
> Generated headers from third project are used by first and second
> project.
>
> the application project looks like (in a hudge simplification):
>   project(application)
>   add_subdirectory(librarygen)
>   add_subdirectory(library)
>
>
>   add_executable(application sources1..x)
>
>
> My question is what is the common practice of creating dependencies?
> e.g library project is not aware about how to generate the headers,
> generated makefiles will try to run generation of librarygen and
> compilation library at the same time, since it is wrong
>
> the situation is changing when I manualy specify dependencies:
> add_dependencies(library librarygen)
>
> Is there any other mechanism inside cmake to manage dependencies
> between cmake projects to files that will be generated?
> What is the common practice with code generation?
>
> thanks in advance,
> Lukasz
>
> --
> Lukasz Tasz
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

add_dependencies(library librarygen)

is the common practice when custom inter-dependent steps are spread across
multiple directories.


HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110616/db29523e/attachment.htm>


More information about the CMake mailing list