[CMake] ctest - how to set environment

David Cole david.cole at kitware.com
Wed Feb 20 11:42:41 EST 2008


You could detect that your desired env vars are empty in your
CMakeLists.txtand have CMake emit an error.

IF("$ENV{my_env_var}" STREQUAL "")
  MESSAGE(FATAL_ERROR "error: required env var not set - please set
my_env_var in your environment before running cmake/make/make test")
ENDIF("$ENV{my_env_var}" STREQUAL "")

Then at least all your developers would know early on that they have to set
env vars before running your cmake/make/make test sequence.


On 2/20/08, Jörg Becker <news at elke-joerg.de> wrote:
>
> On Wednesday, 20. February 2008 16:48:39 Bill Lorensen wrote:
> > You can set the CTEST_ENVIRONMENT as it does:
>
>
> As I wrote in my first mail, I'm failed using CTEST_ENVIRONMENT inside a
> CMakeLists.txt. I have not tried this in a special ctest script because
> I'm
> searching for lean solution. Which means write a 'CMakeList.txt' once,
> run 'cmake' once and be able to run 'make test' for every change on my
> software. My problem is: there is make test target, I want to use it, but
> all
> tests fail because of the missing environment variables.
>
> Maintaining a ctest script besides the CMakeLists.txt is too much effort
> for
> my current purpose. As described in
> http://www.cmake.org/Wiki/CMake_Testing_With_CTest "Simple Testing"
> ("The easiest way to create CTest input files is using CMake."), I just
> want
> to generate / call the tests within the build process (with the existing
> test
> target), and not define/maintain a parallel build/test process.
>
>
> 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/cd0d51ec/attachment.htm


More information about the CMake mailing list