<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
The ENVIRONMENT property worked for me. Thank you!<br>
<br>
And I will look at the python virtual environment.<br>
<br>
<br>
On 05/03/12 07:12, Bradley Lowekamp wrote:
<blockquote
cite="mid:6EB30BD0-EEEA-45E3-B659-35DD6BA15BA9@mail.nih.gov"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hello,
<div><br>
</div>
<div>For testing python another alternative is to create a python
virtual environment and install you python package into that.
Here is an example of how I have done that:</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://github.com/SimpleITK/SimpleITK/blob/master/Wrapping/CMakeLists.txt#L97">https://github.com/SimpleITK/SimpleITK/blob/master/Wrapping/CMakeLists.txt#L97</a></div>
<div><br>
</div>
<div>Brad</div>
<div><br>
<div>
<div>On May 2, 2012, at 9:26 PM, David Cole wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Are you using "add_test" to add the tests in the
CMakeLists file?<br>
<br>
If so, you can set the test ENVIRONMENT property to set
PYTHONPATH<br>
when ctest executes the test. See property doc here:<br>
<br>
<a moz-do-not-send="true"
href="http://cmake.org/cmake/help/v2.8.8/cmake.html#prop_test:ENVIRONMENT">http://cmake.org/cmake/help/v2.8.8/cmake.html#prop_test:ENVIRONMENT</a><br>
<br>
<br>
On Wed, May 2, 2012 at 5:17 PM, Lori A. Pritchett-Sheats<br>
<<a moz-do-not-send="true"
href="mailto:lpritch@lanl.gov">lpritch@lanl.gov</a>>
wrote:<br>
<blockquote type="cite">I'm building Python modules using
SWIG and CMake, and have run into a<br>
</blockquote>
<blockquote type="cite">problem running Python unit tests
for these built modules. I can not find a<br>
</blockquote>
<blockquote type="cite">slick way to set the Python module
search path when running the test. The<br>
</blockquote>
<blockquote type="cite">usual trick of setting sys.path in
the scripts will not work here because I<br>
</blockquote>
<blockquote type="cite">don't know the location of the
build directory. I've tried updating<br>
</blockquote>
<blockquote type="cite">PYTHONPATH in my CMakeList.txt
file but that change isn't picked up when the<br>
</blockquote>
<blockquote type="cite">test is executed. I could create
the unit test modules at build time using<br>
</blockquote>
<blockquote type="cite">CONFIGURE_FILE replacing
@CMAKE_CURRENT_BINARY_DIR@ in a sys.path line, but<br>
</blockquote>
<blockquote type="cite">that seems heavy-handed. Has
anyone else run into this problem and found<br>
</blockquote>
<blockquote type="cite">better a solution?<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">--<br>
</blockquote>
<blockquote type="cite">Lori A. Pritchett-Sheats, PhD.<br>
</blockquote>
<blockquote type="cite">CCS-2, Computational Physics and
Methods<br>
</blockquote>
<blockquote type="cite">Office: 505-665-6675<br>
</blockquote>
<blockquote type="cite">Fax: 505-665-4972<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Los Alamos National Laboratory<br>
</blockquote>
<blockquote type="cite">P.O. Box 1663<br>
</blockquote>
<blockquote type="cite">MS D413<br>
</blockquote>
<blockquote type="cite">Los Alamos, NM 87544<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">--<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Powered by <a
moz-do-not-send="true" href="http://www.kitware.com">www.kitware.com</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Visit other Kitware open-source
projects at<br>
</blockquote>
<blockquote type="cite"><a moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Please keep messages on-topic and
check the CMake FAQ at:<br>
</blockquote>
<blockquote type="cite"><a moz-do-not-send="true"
href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Follow this link to
subscribe/unsubscribe:<br>
</blockquote>
<blockquote type="cite"><a moz-do-not-send="true"
href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote>
--<br>
<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com">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">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">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">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div>
</blockquote>
</div>
<br>
<div>
<span class="Apple-style-span" style="font-size: 12px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="border-collapse:
separate; -webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px; color: rgb(0, 0,
0); font-family: Helvetica; font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal;
-webkit-text-decorations-in-effect: none; text-indent:
0px; -webkit-text-size-adjust: auto; text-transform:
none; orphans: 2; white-space: normal; widows: 2;
word-spacing: 0px; ">
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3">========================================================</font></p>
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3">Bradley
Lowekamp<span class="Apple-converted-space"> </span><span
class="Apple-converted-space"> </span></font></p>
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3">Medical
Science and Computing for</font></p>
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3">Office of
High Performance Computing and Communications</font></p>
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3">National
Library of Medicine<span
class="Apple-converted-space"> </span></font></p>
<p style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; "><font
style="font: normal normal normal 12px/normal
Helvetica; " face="Helvetica" size="3"><a
moz-do-not-send="true"
href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p>
<br class="Apple-interchange-newline">
</span></div>
</span><br class="Apple-interchange-newline">
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Lori A. Pritchett-Sheats, PhD.
CCS-2, Computational Physics and Methods
Office: 505-665-6675
Fax: 505-665-4972
Los Alamos National Laboratory
P.O. Box 1663
MS D413
Los Alamos, NM 87544
</pre>
</body>
</html>