[CMake] Problem setting ENVIRONMENT for ctest

David Cole david.cole at kitware.com
Fri Dec 3 13:12:13 EST 2010


What version of cmake/ctest are you using?
(i.e. -- send the output of "cmake --version")

What does CTestTestfile.cmake contain if you change your CMakeLists
file to use set_property(TEST ...) instead of set_tests_properties()?

This should work as expected in CMake. We have a test in the test
suite that tests the ENVIRONMENT test property at
CMake/Tests/Environment/CMakeLists.txt -- the test uses
set_tests_properties.


???
David


On Fri, Dec 3, 2010 at 12:37 PM, Johannes Wienke
<jwienke at techfak.uni-bielefeld.de> wrote:
> Dear all,
>
> I am try to set the PATH environment variable on windows for running the
> unit tests through ctest. The ctest file is generated by the cmake scripts.
> The PATH is required to for finding additional dlls required by the tests.
>
> I tried to set the PATH using this cmake code:
>
> SET(PATH_STRING "$ENV{PATH};${Boost_LIBRARY_DIRS}")
> STRING(REPLACE ";" "\\;" PATH_STRING "${PATH_STRING}")
> SET_TESTS_PROPERTIES(rsbtest PROPERTIES ENVIRONMENT "PATH=${PATH_STRING}")
>
> This is done according to this list posting some time ago:
> http://www.cmake.org/pipermail/cmake/2009-May/029464.html
>
> However, it does not work for me. PATH is not changed when calling ctest and
> the dlls are not found. I investigated a bit and found out that the
> resulting CTestTestfile.cmake file contains these lines for every specified
> test:
>
> ADD_TEST(rsbtest "<correct binary>")
> SET_TESTS_PROPERTIES(rsbtest PROPERTIES  ENVIRONMENT "PATH=<correct path
> with correct escapes>")
>
> However, "man ctest" does not even document that SET_TESTS_PROPERTIES is a
> valid command for ctest. Instead SET_PROPERTY(TEST...) is explained. So I
> changed the generated CTestTestfile.cmake according to this information to:
>
> ADD_TEST(rsbtest "<correct binary>")
> SET_PROPERTY(TEST rsbtest PROPERTY ENVIRONMENT "PATH=<correct path with
> correct escapes>")
>
> Afterwards all unit tests run as expected.
>
> What am I doing wrong here? Or is this a bug in cmake?
>
> Thanks for any help!
> Johannes
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list