[CMake] setup enviroment for all tests

David Cole dlrdave at aol.com
Thu Jul 31 06:10:20 EDT 2014


CMake itself does this to include a file at ctest time that applies to
*all* tests:

  set_directory_properties(PROPERTIES
    TEST_INCLUDE_FILE
    "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")

It results in this line being generated in CTestTestfile.cmake at the
very top of the file:

   include("C:/n/d/Nightly/cmake
Win32-ninja-cl11-Debug/Tests/EnforceConfig.cmake")

If you wrote/configured a file that had this in it (can be in your
build tree, as CMake's is...):

  set(ENV{PATH} "/actual/value/of/XXXX_BINDIR:$ENV{PATH}")

...and then set that file as your TEST_INCLUDE_FILE, it should do what
you want in this case.

The documentation is sparse, but there:

  http://www.cmake.org/cmake/help/v3.0/prop_dir/TEST_INCLUDE_FILE.html


HTH,
David C.



More information about the CMake mailing list