<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Good day all,<br>
<br>
I am using ADD_TEST like this:<br>
<br>
ADD_TEST(<br>
nameOfMyTest<br>
${CMAKE_CTEST_COMMAND}<br>
--build-and-test ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}<br>
--build-generator ${CMAKE_GENERATOR}<br>
--build-makeprogram ${CMAKE_BUILD_TOOL}<br>
--build-nocmake<br>
--build-noclean<br>
--build-project ${MY_PRODUCT_NAME}<br>
--build-target someTestTarget<br>
)<br>
<br>
-- that is: <b>ctest --build-and-test</b> is invoked "from within"
the test.<b> ctest --build-and-test</b> will in turn invoke the
build tool: <br>
<br>
<b>make someTestTarget</b> <br>
<br>
(assuming Unix make is the build tool). <br>
<br>
That's correct so far, isn't it?<br>
<br>
Question: <br>
<br>
I would now like to specify an environment variable in this
CMakeLists.txt, namely "TJO=SAN", that affects the invocation of <b>make
someTestTarget</b>. The result would be that ctest
--build-and-test "creates" an invocation like:<br>
<br>
<b>TJO=SAN make someTestTarget</b><br>
<br>
How can I do that? A naïve idea would be to write <br>
<br>
SET_PROPERTY(TEST nameOfMyTest PROPERTY ENVIRONMENT "TJO=SAN" )<br>
<br>
-- but that will not work (right?) Because it will only set the
environment variable for the invocation of ctest:<br>
<br>
<b>TJO=SAN ctest --build-and-test ....</b><br>
<br>
-- but <i>not</i> the subsequent call to make. <br>
<br>
Any ideas? <br>
<br>
<i>Is there any way to tell <b>ctest --build-and-test</b> to set an
environment variable for the invocation of the build tool?</i><br>
<br>
Best,<br>
<br>
- Hugo Heden<br>
<br>
FOI, Sweden<br>
<a class="moz-txt-link-abbreviated" href="http://www.foi.se">www.foi.se</a><br>
<br>
</body>
</html>