[CMake] CMake library installations and pkg-config

Konstantin Tokarev annulen at yandex.ru
Wed Aug 31 09:32:23 EDT 2016



31.08.2016, 16:22, "Nick Appleton" <nick at appletonaudio.com>:
> Hi,
>
> I’ve been recently doing a bit of work for an open source project trying to extend it’s support for CMake. I’ve been trying to get CMake to be able to replicate most of the functionality which can be achieved with the existing autoconf-based infrastructure (and have had pretty good success) but am struggling to figure out how to get CMake to generate pkg-config files on unix-ey systems. I’ve done quite a lot of searching, but have not found anything which provides a good solution for our use case.

Do you consider contributing to https://api.kde.org/ecm/module/ECMGeneratePkgConfigFile.html ?

>
> The project is called portaudio (a cross-platform, C, real-time audio library) and at present there is one CMakeLists.txt file which does everything (I’ve tried to keep it clean), you can see it here: https://app.assembla.com/spaces/portaudio/git/source/cmake_updates/CMakeLists.txt
>
> It looks for various audio libraries which may be present on the system using find_package() and associates them with the library which it defines using target_link_libraries(). This is all great when my CMake project includes portaudio (via add_subdirectory() and target_link_libraries() with one of the portaudio library targets), but if I want “make install”-like functionality so that others can use a portaudio installation without requiring CMake, I would like to be able to generate a pkg-config file which contains the necessary linker arguments to pass when linking against the library. The generation of the pkg-config file is straight-forward using the configure_file() function, but I am struggling to find a way to: given a CMake target, create a variable containing the set of linker paths and library names to use in the pkg-config file.
>
> Can anyone give me some hints as to whether this is possible?
>
> Cheers,
>
> Nick
>
> --
>
> 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

-- 
Regards,
Konstantin


More information about the CMake mailing list