[CMake] Dependencies between independent projects

Alexander Broekhuis a.broekhuis at gmail.com
Thu May 3 04:30:14 EDT 2012


Hi André,

2012/5/2 André Caron <andre.l.caron at gmail.com>
>
> I've come up with a simple workflow where each library project exports a
> "library-config.cmake" file and any project that includes it defines the
> "library_DIR" variable to the folder containing this "library-config.cmake"
> file so that it can be resolved from anywhere in the CMake scripts using
> only "find_package()".  This way, when the library can either set the
> "library_DIR" variable or inherit it from the parent project.  This solves
> the problem of using either its own Git submodule or a parent project's Git
> submodule, ensuring you build the library only once for the entire project
> and that all sub-projects use the same version.
>

I am testing with a similar solution, having an example is great! I like
the solution on how to build the dependencies (using the add_subdirectory
in the config.cmake). I might need to reorder my project a little bit for
this, but definitely looks useful!


> I'm slowly converting all my projects to CMake using this pattern.  You
> can find some of those on my GitHub profile[2].  One example is cfcgi[3].
>  Note that I'm learning a lot along the way and I don't guarantee that all
> of this conforms to CMake best practices.  I'm only referring to this for
> the project structure and CMake concept to clarify my explanation with an
> example.  That being said, if anyone has comments about the CMake scripts
> in there, your input is welcome :-)
>

I'll see if I can make an example for my usecase. If I have some
comments/additions I will post them here.


-- 
Met vriendelijke groet,

Alexander Broekhuis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120503/6d5d441e/attachment.htm>


More information about the CMake mailing list