[CMake] PKGCONFIG("dbus-1 >= 1.0.0" ...) should also possible

Claus Klein claus.klein at arcormail.de
Thu Jan 11 12:56:20 EST 2007


Hi,

to be more flexible, here is a patch for UsePkgConfig.cmake

#   PKGCONFIG("dbus-1 >= 1.0.0" ...) is now also possible.

#   Optional, for stage building, the
#   PKGCONFIG_OPTIONS and PKG_CONFIG_PATH environment variable are used if set!
# see man pkg-config for more info; ck

e.g. PKG_CONFIG_PATH=/mystagedir/lib/pkgconfig  PKGCONFIG_OPTIONS="--define-variable=prefix=/mystagedir" cmake ..
will get the right paths set from pkg-config to compile and link against the packages installed in /mystagedir

With my patch, cross-compile is also better supported as this build log shows:

--- log starts here ---
+ uname -a
Linux P3linux 2.6.16.21-0.25-default #1 Tue Sep 19 07:26:15 UTC 2006 i686 i686 i386 GNU/Linux

+ find /tools/LinuxPpcCDK/ -type d -name include -o -name lib -o -name pkgconfig -o -name '*.pc'
/tools/LinuxPpcCDK/lib
/tools/LinuxPpcCDK/lib/pkgconfig
/tools/LinuxPpcCDK/lib/pkgconfig/openssl.pc
/tools/LinuxPpcCDK/lib/pkgconfig/dbus-1.pc
/tools/LinuxPpcCDK/lib/pkgconfig/avahi-core.pc
/tools/LinuxPpcCDK/lib/pkgconfig/libdaemon.pc
/tools/LinuxPpcCDK/lib/pkgconfig/avahi-client.pc
/tools/LinuxPpcCDK/lib/dbus-1.0/include
/tools/LinuxPpcCDK/lib/gcc-lib/powerpc-linux-uclibc/3.3.6/install-tools/include
/tools/LinuxPpcCDK/lib/gcc-lib/powerpc-linux-uclibc/3.3.6/include
/tools/LinuxPpcCDK/usr/lib
/tools/LinuxPpcCDK/usr/include
/tools/LinuxPpcCDK/powerpc-linux-uclibc/lib
/tools/LinuxPpcCDK/include

+ PKG_CONFIG_PATH=/tools/LinuxPpcCDK/lib/pkgconfig/
+ pkg-config --modversion --libs --print-errors dbus-1
0.60
-L//lib -ldbus-1		<<<<<<<<<<<<<<<<<<< this would be wrong!

+ cd /home/claus/src/wzdftpd/trunk/build
+ rm -rf CMakeCache.txt 

+ CXX=/tools/LinuxPpcCDK/bin/powerpc-linux-g++
+ AR=/tools/LinuxPpcCDK/bin/powerpc-linux-ar
+ PKG_CONFIG_PATH=/tools/LinuxPpcCDK/lib/pkgconfig
+ PKGCONFIG_OPTIONS=--define-variable=prefix=/tools/LinuxPpcCDK
+ CMAKE_LIBRARY_PATH=/tools/LinuxPpcCDK/lib:/tools/LinuxPpcCDK/usr/lib
+ CMAKE_INCLUDE_PATH=/tools/LinuxPpcCDK/include:/tools/LinuxPpcCDK/usr/include
+ cmake -DWITH_OpenSSL=ON -DWITH_TCLDev=OFF -DWITH_PerlDev=OFF -DWITH_GnuTLS=OFF 
+           -DWITH_PostgreSQL=OFF -DWITH_MySQL=OFF -DWITH_Zeroconf=ON -DWITH_TESTS=OFF ..
-- Check for working C compiler: /tools/LinuxPpcCDK/bin/powerpc-linux-gcc
-- Check for working C compiler: /tools/LinuxPpcCDK/bin/powerpc-linux-gcc -- works
-- Check size of void*
-- Check size of void* - done
-- Found OpenSSL: /tools/LinuxPpcCDK/lib/libssl.so
-- Linkdir of dbus-1 is: /tools/LinuxPpcCDK/lib IncludeDir is: /tools/LinuxPpcCDK/include		<<<<<<<<<<<<<<<<<<< this is OK

. . .


It would be nice, if my patch will accepted.


-Claus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UsePkgConfig.cmake.patch
Type: text/x-diff
Size: 2334 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070111/772dd658/UsePkgConfig.cmake.bin


More information about the CMake mailing list