[CMake] ctest - how to set environment

Bill Lorensen bill.lorensen at gmail.com
Wed Feb 20 10:48:39 EST 2008


If you use ctest scripts (http://www.cmake.org/Wiki/CMake_Scripting_Of_CTest )
like this one from vtk:
http://www.vtk.org/Testing/Sites/hythloth.kitware/Linux-gcc41/20080220-0300-Nightly/Notes.html

You can set the CTEST_ENVIRONMENT as it does:
# set any extra envionment variables here
SET (CTEST_ENVIRONMENT
  "DISPLAY=:50"
  "CC=gcc-4.1"
  "CXX=g++-4.1"
  "CFLAGS=-Wall -W"
  "CXXFLAGS=-Wall -W -Woverloaded-virtual -Wunused -Wno-deprecated"
  "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
  )

Also, the ctest scripts specify all of the cmake cache options for your
project.
itk (
http://www.itk.org/Testing/Dashboard/MostRecentResults-Nightly/Dashboard.html
 )
and
vtk (
http://www.vtk.org/Testing/Dashboard/MostRecentResults-Nightly/Dashboard.html
 )

both make extensive use of ctest scripting. On these dashboards, click on
the text icon next to the build name to see (for most builds) the ctest
script that is used to create that configure/build/test submission.

Bill
On Wed, Feb 20, 2008 at 10:28 AM, Jörg Becker <news at elke-joerg.de> wrote:

> 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
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080220/c269efbd/attachment.htm


More information about the CMake mailing list