[CMake] Help for a cmake newbie

Tamás Kenéz tamas.kenez at gmail.com
Sun Jan 31 09:08:05 EST 2016


Vadtec,

> My main problem is getting cmake to use only my locally
installed/compiled copies of the libs. I need those libs to live along side
the binaries, and using the versions I compile is important.

I'll answer the question of finding the libraries and not the building
problem. We (in my company) are facing similar problems. This is the
workflow which has been working for us:

1. we make sure that all 3rdparty dependencies can be built with CMake and
install a config-module

Note that the "can be built with CMake" needs to be interpreted loosely:

- some 3rdparty libs already provide CMake builds which can be used as is.
In case of anything is missing (config-module) we fork and modify
- when a 3rdparty lib uses autotools we rewrite its build system in CMake
for windows compatibility
- in case the lib's build system is too complex we just wrap it in a CMake
build which launches autotools and also installs a config-module
- when only the binaries of the 3rdparty lib are available we create a
CMakeLists for the lib which detects the platform, installs the required
binaries and config-modules

In any case we end up having a project that can be built with cmake command
lines and installs a proper config-module.

2. For these 3rdparty libs we don't use the find-modules distributed with
CMake. We Set the CMAKE_PREFIX_PATH to the install prefix where we
installed our 3rdparty deps to make sure only those will be found by our
own projects.

On Sun, Jan 31, 2016 at 9:40 AM, Cristian Adam <cristian.adam at gmail.com>
wrote:

> On 31-Jan-16 03:42, vadtec wrote:
>
>
> curl, libiconv, libpng, libssh2, and zlib are the libs I want to build and
> use both on Linux and Windows. I know all of those are available on Linux
> and I could use the system installed versions, but I want to use the same
> vesions on Windows as well. The server is only built on Linux, while the
> client needs to be built for Linux and Windows. All the libs, headers, etc
> go into the build directory, and the final "make install" puts everything
> into the bundle directory, so it can be packaged for distribution.
>
>
> Have a look at hunter <https://github.com/ruslo/hunter/> – Cross-platform
> package manager for C++ (based on CMake ExternalProject).
>
> Hunter has CMake versions for:
>
>    - libpng <https://github.com/ruslo/hunter/wiki/pkg.png>
>    - libssh2 <https://github.com/ruslo/hunter/wiki/pkg.libssh2>
>    - zlib <https://github.com/ruslo/hunter/wiki/pkg.zlib>
>
> Curl <https://github.com/bagder/curl> has CMake support by itself. The
> only library missing is libiconv. It seems that
> LuaDist project has added  a CMake build here
> <https://github.com/LuaDist/libiconv>.
>
> You could either take all the libraries and include in your project or
> open hunter tickets. <https://github.com/ruslo/hunter/issues>
>
> Cheers,
> Cristian.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160131/d24bbcb2/attachment.html>


More information about the CMake mailing list