Good day all,

I am using ADD_TEST like this:

  ADD_TEST(
    nameOfMyTest
    ${CMAKE_CTEST_COMMAND}
    --build-and-test  ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
    --build-generator ${CMAKE_GENERATOR}
    --build-makeprogram ${CMAKE_BUILD_TOOL}
    --build-nocmake
    --build-noclean
    --build-project ${MY_PRODUCT_NAME}
    --build-target someTestTarget
    )

-- that is: *ctest --build-and-test* is invoked "from within" the test.*ctest --build-and-test* will in turn invoke the build tool:

*make someTestTarget*

(assuming Unix make is the build tool).

That's correct so far, isn't it?

Question:

I would now like to specify an environment variable in this CMakeLists.txt, namely "TJO=SAN", that affects the invocation of *make someTestTarget*. The result would be that ctest --build-and-test "creates" an invocation like:

*TJO=SAN make someTestTarget*

How can I do that? A naïve idea would be to write

SET_PROPERTY(TEST nameOfMyTest PROPERTY ENVIRONMENT "TJO=SAN" )

-- but that will not work (right?) Because it will only set the environment variable for the invocation of ctest:

*TJO=SAN ctest --build-and-test ....*

-- but /not/ the subsequent call to make.

Any ideas?

/Is there any way to tell *ctest --build-and-test* to set an environment variable for the invocation of the build tool?/

Best,

- Hugo Heden

FOI, Sweden
www.foi.se

_______________________________________________
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

Reply via email to