<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
David,<br>
<br>
Awesome! That did the trick!<br>
<br>
Thanks for the advice.<br>
<br>
-scott<br>
<br>
David Cole wrote:
<blockquote
cite="mid:f435c2c50905121313v6b092e02ld1c7dbc7121022eb@mail.gmail.com"
type="cite">I think it's just a semicolon problem. Unfortunately for
all of us Windows PATH and CMake both use ";" 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 ";" "\\;" NEWPATH "${NEWPATH}")<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"><<a moz-do-not-send="true" href="mailto:sgray@inventa.com">sgray@inventa.com</a>></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's (see my previous posting
entitled "add_test and locating dependent DLL's on Windows"), 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't operator error.<br>
<br>
First, I created a very simple test program:<br>
<br>
===== BEGIN: Env_test.cpp ======<br>
#include <stdio.h><br>
#include <stdlib.h><br>
<br>
void main (int argc, char *argv[])<br>
{<br>
char *p = getenv("PATH");<br>
fprintf(stdout, "PATH = %s\n", 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 "Windows")<br>
set (NEWPATH "C:\\some_dir1;C:\\some_dir2;$ENV{PATH}")<br>
message("NEWPATH = ${NEWPATH}")<br>
set_tests_properties(Env_test PROPERTIES ENVIRONMENT
"PATH=${NEWPATH}")<br>
endif()<br>
===== END: CMakeLists.txt ======<br>
<br>
When I run 'cmake -G "Visual Studio 8 2005"', 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: "C:/cmake_bug/debug/Env_test.exe"<br>
Directory: C:/cmake_bug<br>
"Env_test" start time: May 12 14:03 Eastern Daylight Time<br>
Output:<br>
----------------------------------------------------------<br>
PATH = C:\some_dir1^M<br>
----------------------------------------------------------<br>
Test Passed.<br>
"Env_test" end time: May 12 14:03 Eastern Daylight Time<br>
"Env_test" 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'm
running on last night'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 moz-do-not-send="true" href="http://www.kitware.com"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
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
moz-do-not-send="true" 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 moz-do-not-send="true"
href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Scott C. Gray
Chief Technologist
ANTs Software, Inc.
Inventa Technologies, Inc.
(W) 856-914-5212
(C) 609-304-3429
</pre>
</body>
</html>