[CMake] pkg-config custom options

Remy Chibois rchibois at gmail.com
Sat Feb 28 04:21:52 EST 2009


Hi all,
as part of our internal software build system, we make heavy use of
pkg-config .pc files, and found very useful to parametrize compile options
and paths using pkg-config's "--define-variable" command line option (e.g.:
use a build "chroot" or not).

So far, I've been unable to find a satisfying cross-platform way of doing
this, using CMake, so I modified FindPkgConfig.cmake to allow custom options
to be used when calling pkg-config.

I'm not a long time CMake user and it may not be the best CMake way to
achieve this.

Here's how to use it:

---
include(FindPkgConfig)
set(PKG_CONFIG_CUSTOM_OPTIONS
"--define-variable=mypcvar=/somewhere/on/your/disk")

pkg_check_modules(MYMODULE REQUIRED mymodule)
---

A patch against CMake 2.6.3 is attached, in the hope it will be useful to
someone else.

-- 
    Remy Chibois
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090228/82af1eb1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pkgconfig-options.patch.gz
Type: application/x-gzip
Size: 426 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090228/82af1eb1/attachment.bin>


More information about the CMake mailing list