[CMake] retreiving the libraries the maven way?

Andreas Pakulat apaku at gmx.de
Mon Jan 14 14:17:11 EST 2013


Hi,

On Mon, Jan 14, 2013 at 9:17 AM, Nicolas Herbaut <n.herbaut at progexia.net> wrote:
> I started working on a new c++ project comming back after 4+ years of java
> coding.
>
> For java, I use nexus, which is a binary repository server, that provides an
> nice REST API that allows clients to download dependencies by providing the
> library name and a target version.
>
> I'm wondering if it would be feasible and difficult to port this logic into
> a cmake plugin, and allowing the find_library to seamlessly retreive the
> library from the system OR from a nexus server.
>
> currently all our dependencies are stored in the svn, which slows down our
> builds and is not very flexible.
>
> Let me be more specific by describing my usecase.
>
> 1- On a Windows PC, I need the zlib dll and the standard C dll to build my
> project
> 2- I issue a find_library command specifying both custom library paths and a
> nexus server URL
> 3 - for the standard C library, cmake findsout that it's already located
> into the system
> 4 - for zlib, cmake performs a request to the server which acknowledge the
> availability of the dll
> 5 - cmake downloads the library in a cache folder and tells the generator to
> link to the library it downloaded
> 6 - if the library cannot be found on the system and on the binary server,
> cmake fails
> 7 - the same thing happen on a mac system, but this time both the C lib and
> zlib are on the path, hence binary server is not even queried for a lib.

I think for C++ this is lot more impractical than for Java because
compiled C++ code is inherently unportable. You get a really big
matrix of versions, compilers and platforms. For example on windows
you have 6 msvc compilers in 2 architectures, 2 gcc-variants in 2
architectures, intel in 2 architectures. Possibly you'd even need
different versions for different windows versions. For MacOSX you only
have 2 compilers usually per MacOSX version you want to support. On
Linux there are breakages of the libc or libstdc++ ABI every few
years. And you'd have to multiply that with the number of versions
zlib provides. And then multiply that by the number of libraries you
want to support.

Its not undoable, but its a huge amount of libs a lot that can go
wrong and a lot to build up and maintain in the first place.

In addition to that, CMake has no plugin system I believe, so you'd
have to add that to the source code itself.

Andreas


More information about the CMake mailing list