[CMake] Setting environment variables prebuild

Alexander Neundorf a.neundorf-work at gmx.net
Mon Mar 9 20:00:22 EDT 2009


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

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

Same here.

Alex


More information about the CMake mailing list