I think it&#39;s just a semicolon problem. Unfortunately for all of us Windows PATH and CMake both use &quot;;&quot; as their list separator character.<br><br>And the set_test_properties ENVIRONMENT property is a semicolon delimited list of name1=value1;name2=value2;name3=value3;...etc...<br>
<br>To embed ; characters inside of a value, try this after setting NEWPATH and before calling set_test_properties:<br>STRING(REPLACE &quot;;&quot; &quot;\\;&quot; NEWPATH &quot;${NEWPATH}&quot;)<br><br>Let us know if it works for you...<br>
<br>Thanks,<br>David<br><br><br><div class="gmail_quote">On Tue, May 12, 2009 at 2:34 PM, Scott Gray <span dir="ltr">&lt;<a href="mailto:sgray@inventa.com">sgray@inventa.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
While trying to research the answer to my question about how to make your test program locate its dependent DLL&#39;s (see my previous posting entitled &quot;add_test and locating dependent DLL&#39;s on Windows&quot;), I decided to try the recently added ENVIRONMENT property of set_tests_properties to set the PATH for the test program. I *think* I have found an issue with it, but before I open a bug, I wanted to check to see if this isn&#39;t operator error.<br>

<br>
First, I created a very simple test program:<br>
<br>
===== BEGIN: Env_test.cpp ======<br>
#include &lt;stdio.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
<br>
void main (int argc, char *argv[])<br>
{<br>
   char *p = getenv(&quot;PATH&quot;);<br>
   fprintf(stdout, &quot;PATH = %s\n&quot;, p);<br>
}<br>
===== END: Env_test.cpp ======<br>
And then the CMakeLists.txt<br>
<br>
===== BEGIN: CMakeLists.txt ======<br>
cmake_minimum_required(VERSION 2.7)<br>
enable_testing()<br>
<br>
add_executable (Env_test Env_test.cpp)<br>
add_test (Env_test Env_test)<br>
<br>
if (${CMAKE_SYSTEM_NAME} STREQUAL &quot;Windows&quot;)<br>
       set (NEWPATH &quot;C:\\some_dir1;C:\\some_dir2;$ENV{PATH}&quot;)<br>
       message(&quot;NEWPATH = ${NEWPATH}&quot;)<br>
       set_tests_properties(Env_test PROPERTIES ENVIRONMENT &quot;PATH=${NEWPATH}&quot;)<br>
endif()<br>
===== END: CMakeLists.txt ======<br>
<br>
When I run &#39;cmake -G &quot;Visual Studio 8 2005&quot;&#39;, I get the message:<br>
<br>
   NEWPATH = C:\some_dir1;C:\some_dir2;C:\Program Files\CollabNet...<br>
<br>
And if I run Env_test.exe by hand, it properly prints out whatever my current PATH is.<br>
<br>
However, when I run ctest, the output contained in the LastTest.log shows:<br>
<br>
Start testing: May 12 14:03 Eastern Daylight Time<br>
----------------------------------------------------------<br>
Changing directory into: C:/cmake_bug<br>
1/1 Testing: Env_test<br>
1/1 Test: Env_test<br>
Command: &quot;C:/cmake_bug/debug/Env_test.exe&quot;<br>
Directory: C:/cmake_bug<br>
&quot;Env_test&quot; start time: May 12 14:03 Eastern Daylight Time<br>
Output:<br>
----------------------------------------------------------<br>
PATH = C:\some_dir1^M<br>
----------------------------------------------------------<br>
Test Passed.<br>
&quot;Env_test&quot; end time: May 12 14:03 Eastern Daylight Time<br>
&quot;Env_test&quot; time elapsed: 00:00:00<br>
----------------------------------------------------------<br>
<br>
End testing: May 12 14:03 Eastern Daylight Time<br>
<br>
<br>
No matter what I set the PATH to in my CMakeLists.txt, the test program always dumps on the first component of the path leading up to the first semicolon in the path.<br>
<br>
So, is this operator error or a bug in the new feature?  Oh, I&#39;m running on last night&#39;s build of cmake (version 2.7.20090512).<br>
<br>
<br>
Thanks,<br>
-scott<br>
<br>
-- <br>
Scott C. Gray<br>
Chief Technologist<br>
ANTs Software, Inc.<br>
Inventa Technologies, Inc.<br>
(W) 856-914-5212<br>
(C) 609-304-3429<br>
<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>