[CMake] ctest - how to set environment

Jörg Becker news at elke-joerg.de
Wed Feb 20 10:28:41 EST 2008


On Tuesday, 19. February 2008 19:20:46 Philip Lowman wrote:
> What you're looking for to the best of my knowledge doesn't exist in
> CMake.  I would file a feature request on the bugtracker for it.  There
> probably should be a way for declaring custom environment variables and
> associating them with tests scheduled with ADD_TEST (the PATH environment
> variable for Windows comes to mind as one possible use case).
>
done

> If you're using the makefile generator you can obviously just declare
> environment variables prior to running your tests.  If you're using Visual
> Studio to execute your tests you're probably out of luck here.  Best bet
> would be to revert to testing them in command line mode:
>
I tried 'set( ENV{ICU_DATA} "foo" )' with the same result (variable not set 
within test session).

> (or for Unix/Makefile generator using bash)
> user at host:~/build$ export foo=bar    (Unix, bash)
> user at host:~/build$ ctest
>
Yes, this is the way it works. But it's not very comfortable.

'make test' would be much easier than 'make depend;export foo=bar;ctest'. 
Especially if there where more than one environment variable to be set.


Thanks,
Jörg


More information about the CMake mailing list