<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Upon further consideration, I think fixing the codeblocks project file is probably too specific of a fix. After all, the only way to come across this issue is if you are cross-compiling, in which case you need to write a toolchain file anyway. The problem here, IMHO, is that there are insufficient capabilities for setting up the build environment when cross-compiling. It should be possible to setup all the necessary environment conditions in the toolchain.cmake file, so that I can have different environment variables depending on what I'm cross-compiling for.<BR>
<BR>
The following patch to the underlying Makefile solves the problem for all IDEs that build using UNIX makefiles:<BR>
<BR>
<BLOCKQUOTE>
    <TT>--- Makefile 2009-03-10 10:02:10.250079759 +0100</TT><BR>
    <TT>+++ Makefile_QNX 2009-03-10 10:31:20.359078662 +0100</TT><BR>
    <TT>@@ -29,6 +29,12 @@</TT><BR>
    <TT>#=============================================================================</TT><BR>
    <TT># Set environment variables for the build.</TT><BR>
    <BR>
    <TT>+# QNX Environment Variables</TT><BR>
    <TT>+QNX_HOST := /home/kito/work/qnx640/host/linux/x86</TT><BR>
    <TT>+QNX_TARGET := /home/kito/work/qnx640/target/qnx6</TT><BR>
    <TT>+QNX_CONFIGURATION := /etc/qnx</TT><BR>
    <TT>+Path := ${Path};/home/kito/work/qnx640/host/linux/x86/usr/bin</TT><BR>
    <TT>+</TT><BR>
    <TT># The shell in which to execute make rules.</TT><BR>
    <TT>SHELL = /bin/sh</TT><BR>
</BLOCKQUOTE>
I'm sure there are similar solutions that would apply for the other build systems. Being able to set a series of environment variables and their values in the toolchain file would be a much more general solution that adjusting the individual project files. For example, on the machines I have here, not all of them even have QCC as a compiler option in Codeblocks. Some of them have QCC, but also require changes to the Path environment variable before they will compile cmake projects for qnx. However, the above patch works on all of the machines I've tested, in both Codeblocks and Eclipse. (Of course those paths need to be correct for each machine, but since my toolchain file knows the value of these variables, that shouldn't be a big problem).<BR>
<BR>
-kito<BR>
<BR>
On Tue, 2009-03-10 at 03:11 -0400, cmake-request@cmake.org wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Date: Tue, 10 Mar 2009 01:00:22 +0100
From: Alexander Neundorf &lt;<A HREF="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</A>&gt;
Subject: Re: [CMake] Setting environment variables prebuild
To: <A HREF="mailto:cmake@cmake.org">cmake@cmake.org</A>
Cc: Kito Berg-Taylor &lt;<A HREF="mailto:kito.berg-taylor@dlr.de">kito.berg-taylor@dlr.de</A>&gt;
Message-ID: &lt;<A HREF="mailto:200903100100.22277.a.neundorf-work@gmx.net">200903100100.22277.a.neundorf-work@gmx.net</A>&gt;
Content-Type: text/plain;  charset=&quot;iso-8859-1&quot;

On Tuesday 03 March 2009, Kito Berg-Taylor wrote:
&gt; Hello all,
&gt;
&gt; I'm very new to cmake, so excuse me if I'm missing some obvious
&gt; functionality that cmake already has.
&gt;
&gt; I am building a project using a QNX cross-compile toolchain that I
&gt; setup. For those not familiar with the QNX toolchain, the QNX compiler
&gt; qcc is a wrapper around gcc that's mostly the same but has a few
&gt; peculiarities. Of particular relevance, it requires QNX_HOST and
&gt; QNX_TARGET (and QNX_CONFIGURATION on win32) to be set as environment
&gt; variables. I have setup my toolchain_qnx640.cmake file to automatically
&gt; locate the $QNX_HOST (...etc) path and then set it as follows:
&gt;
&gt; SET( ENV{QNX_HOST} ${PATH_TO_QNX_HOST} )
&gt;
&gt; This allows the configure/generate steps to work correctly, however when
&gt; I go to build the project unless these variables are set separately in
&gt; the environment, the build will fail. In other words, CMake is not
&gt; setting this variable as part of the build (although it did set them
&gt; when it went to test the compiler, because qcc passed the compiler
&gt; test).
&gt;
&gt; When building from UNIX Makefiles I can set the variable at the console
&gt; and then &quot;make&quot; and it will work. When using Codeblocks projects if (and
&gt; only if) I change the project compiler to QCC Compiler it will also
&gt; build, since Codeblocks knows how to setup the environment for QCC. I
&gt; can't find a way to make QCC the default compiler when generating the
&gt; project (otherwise this will get overridden every time the project is
&gt; re-generated). 

You mean the generated project file for CodeBlocks should say that the 
compiler is qcc, but it doesn't ?
Can you please send my a codeblocks project file for a hello-world style 
application using qcc, so I can have a look what it should contain ?

&gt; Eclipse CDT projects similarly won't build, unless I mess
&gt; around with the project settings (new to eclipse, haven't found the
&gt; right settings yet).

Same here.

Alex
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>