[CMake] Preferred way to use 3rd-party dependencies

Yuri Timenkov yuri at timenkov.ru
Sat Feb 26 03:17:20 EST 2011


Ok, let me share chosen approach then.

I decided to use package config and it seems to rock :). That is with only
couple of lines I can easily describe what to link with. The main challenge
is that we work with C++ libraries, and they are configuration- and
compiler-dependent. Look at the boost nightmare for example. And since I
know in advance location and names of all libraries (in my corporate
environment) it is just a matter of few calls to set_target_properties
depending on compiler version, rather than writing monstrous find modules
which usually have a lot of copypasted stuff.

Also it seems that these configs should be very useful when dealing with
intra-company dependencies. Say if we share a library with other department
now we usually put it into both source trees using svn:externals (otherwise
it will be difficult to set up source tree dependencies). But svn:externals
have many pitfalls with branching or synchronizing changes when someone is
in release phase. I know that this may be externals misuse, but when
"convenient" crosses "right" the former usually wins. But with
export(PACKAGE) dealing with such dependencies may be much easier.

So thanks again for great software.

On Fri, Feb 18, 2011 at 2:17 PM, Yuri Timenkov <yuri at timenkov.ru> wrote:

> Dear all,
>
> I haven't been using CMake (and hence following) for almost 3 years and I
> suppose it has a big progress since 2.4.
>
> Now I'm looking for most kosher way to specify external dependencies for a
> particular project. The most straightforward way of specifying include dirs
> and libraries when porting from Visual Studio - is using include_directories
> & link_directories commands. However, I heard that link_directories is not
> very good idea and the preferred way is using imported targets.
>
> Some libraries are internal but built by separate teams for different
> compilers version. Also we don't need to find library & include dir's
> location, we know them in advance (and it is rather fixed).
>
> So may be there are some guides, and discussions or examples about recent
> Find* modules behavior?
>
> Thanks in advance,
> Yuri
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110226/a1d2d5a9/attachment.htm>


More information about the CMake mailing list