Bug#695370: dpkg-cross: sets PKG_CONFIG_LIBDIR rather than telling cmake about a cross pkg-config executable

Colin Watson <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <20121207162723.GC21216__9601.5207971961$1354897833$gmane$org@riva.dynamic.greenend.org.uk>
Package: dpkg-cross
Version: 2.6.7
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch raring

I noticed that /etc/dpkg-cross/cmake/CMakeCross.txt sets
PKG_CONFIG_LIBDIR.  Once the wrapper script from #631275 lands (or for
anyone who's using that already), it's better to use the wrapper: this
also has the effect of using the appropriate multiarch pkg-config paths.
The following patch should make this work without breaking previous
behaviour.

Index: config/cmake/CMakeCross.txt
===================================================================
--- config/cmake/CMakeCross.txt	(revision 8410)
+++ config/cmake/CMakeCross.txt	(working copy)
@@ -24,7 +24,15 @@
   MESSAGE("CROSS COMPILING for ${CMAKE_C_COMPILER}")
   INCLUDE_DIRECTORIES(BEFORE ${CMAKE_FIND_ROOT_PATH}/include)
   #Make pkg-config look in the right place
-  SET(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig/)
+  FIND_PROGRAM(DPKG_CROSS_PKG_CONFIG $ENV{DEB_HOST_GNU_TYPE}-pkg-config)
+  IF (DPKG_CROSS_PKG_CONFIG)
+    # for UsePkgConfig
+    SET(PKGCONFIG_EXECUTABLE ${DPKG_CROSS_PKG_CONFIG})
+    # for FindPkgConfig
+    SET(PKG_CONFIG_EXECUTABLE ${DPKG_CROSS_PKG_CONFIG})
+  ELSE ()
+    SET(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig/)
+  ENDIF ()
 ELSE (CMAKE_CROSSCOMPILING)
   MESSAGE("Native Compile")
 ENDIF (CMAKE_CROSSCOMPILING)

Thanks,

-- 
Colin Watson                                       [[email protected]]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.