<div class="gmail_quote">On Tue, Jun 21, 2011 at 12:09 PM, Hugo Heden <span dir="ltr">&lt;<a href="mailto:heden@foi.se">heden@foi.se</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  

    
  
  <div 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 &quot;from within&quot;
    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&#39;s correct so far, isn&#39;t it?<br>
    <br>
    Question: <br>
    <br>
    I would now like to specify an environment variable in this
    CMakeLists.txt, namely &quot;TJO=SAN&quot;, that affects the invocation of <b>make
      someTestTarget</b>. The result would be that ctest
    --build-and-test &quot;creates&quot; 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 &quot;TJO=SAN&quot; )<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 href="http://www.foi.se" target="_blank">www.foi.se</a><br>
    <br>
  </div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br>It should work -- because the &quot;make&quot; runs as a child process of the ctest --build-and-test call, and the environment set for the outer process should be inherited by all child processes unless otherwise overridden by a child process itself.<br>
<br>HTH,<br>David<br><br>