Bug#695369: dpkg-cross: cmake integration broken: ${DEB_*} -> $ENV{DEB_*}, and set CMAKE_CXX_COMPILER

Colin Watson <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <[email protected]>
Package: dpkg-cross
Version: 2.6.7
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch raring

The cmake integration in dpkg-cross doesn't seem to work at all, or at
least not without some additional help.

Firstly, CMakeCross.txt uses ${DEB_HOST_ARCH} et al.  The correct syntax
(not that I can find any coherent documentation of this) appears to be
$ENV{DEB_HOST_ARCH}.

Secondly, the bit in the cmake documentation that says that you only
need to set one of CMAKE_C_COMPILER and CMAKE_CXX_COMPILER appears to be
what is technically known as a lie: or at least it doesn't work properly
in toolchain files.  I found I needed to set both.

Patch follows.  I feel slightly ill now.

Index: config/cmake/CMakeCross.txt
===================================================================
--- config/cmake/CMakeCross.txt	(revision 8410)
+++ config/cmake/CMakeCross.txt	(working copy)
@@ -4,13 +4,14 @@
 
 # set target system name
 SET (CMAKE_SYSTEM_NAME Linux)
-SET (CMAKE_SYSTEM_PROCESSOR ${DEB_HOST_ARCH})
+SET (CMAKE_SYSTEM_PROCESSOR $ENV{DEB_HOST_ARCH})
 
 #set compiler name
-SET (CMAKE_C_COMPILER ${DEB_HOST_GNU_TYPE}-gcc)
+SET (CMAKE_C_COMPILER $ENV{DEB_HOST_GNU_TYPE}-gcc)
+SET (CMAKE_CXX_COMPILER $ENV{DEB_HOST_GNU_TYPE}-g++)
 
 #set path(s) to search for libraries/binaries/headers
-SET (CMAKE_FIND_ROOT_PATH /usr/${DEB_HOST_GNU_TYPE})
+SET (CMAKE_FIND_ROOT_PATH /usr/$ENV{DEB_HOST_GNU_TYPE})
 # ensure only cross-dirs are searched
 SET (ONLY_CMAKE_FIND_ROOT_PATH TRUE)
 # search for programs in the build host directories

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.