David Cole wrote:

    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.

So, this whole issue has to do with cmake time vs build time. As long as cmake is a running process then you can set env vars. When that process is over then the env is gone. One thing you could do is have your test be run by a cmake script. So, you would wrap your tests in some cmake script that set the environment variable. The scripts would use execute_process to run the tests, and -D options to the script to pass options to your test.

-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to