I believe the way we do this is to use variables like CMAKE_BINARY_DIR to identify the build tree and then append "/bin" and the name of the binary in order to run the test. I don't recall doing anything VS specific within the CMake scripts to make it work. IIRC Visual Studio's generator appends the build type itself or CTest guesses it.<br>
<br>If you're not using a single directory for all of your executables I think CMAKE_CURRENT_BINARY_DIR might be helpful.<br><br><a href="http://www.cmake.org/Wiki/CMake_Useful_Variables">http://www.cmake.org/Wiki/CMake_Useful_Variables</a><br>
<br><div class="gmail_quote">On Fri, Jul 3, 2009 at 4:26 PM, Rupert Brooks <span dir="ltr"><<a href="mailto:rupe.brooks@gmail.com">rupe.brooks@gmail.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;">
Hi everyone,<br>
<br>
I have a feeling this should be obvious, but i cant figure it out.<br>
Probably im using the wrong keywords to search the mailing list.<br>
<br>
What i want to do is add a test (using ADD_TEST, for ctest) that<br>
verifies that my program outputs what it was supposed to output.<br>
CTest, however, expects to use the return value of the program to<br>
determine if the test passed or not. So, i wrote a simple program to<br>
compare the output of a program, and a text file. If it matches, it<br>
returns zero, if not, it returns 1.<br>
<br>
I end up with an addtest line that would look like this<br>
<br>
ADD_TEST(OutputTest CompareOutput "PROGRAM arguments"<br>
"TextFileOfExpectedOutput")<br>
<br>
My problem is the PROGRAM part in the above. I need the path to the<br>
executable that is going to be tested. In particular, i want to<br>
support build systems like visual studio where theres a subdirectory<br>
(Debug, Release, etc) depending on build type, and systems where there<br>
is not such a subdirectory. In fact, visual studio is probably the<br>
troublesome one, i think that something like<br>
${CMAKE_CURRENT_BUILD_DIR}/program_name would work on linux. CTest<br>
has this information internally - since it runs the correct binary<br>
when it runs the test. But i cant figure out a way to get this<br>
information as an argument to the tested program.<br>
<br>
Any suggestions would be appreciated - same goes if theres a better<br>
way to solve the original problem.<br>
<br>
Thanks<br>
Rupert B<br>
<br>
--<br>
--------------------------------------------------------------<br>
Rupert Brooks, Ph. D.<br>
<br>
Attaché de recherches | Research Associate<br>
Simulation des Matériaux Déformables | Simulation of Deformable Materials<br>
Institut des matériaux industriels | Industrial Materials Institute<br>
Conseil national de recherches Canada | National Research Council Canada<br>
75, de Mortagne, Boucherville, Québec, Canada, J4B 6Y4<br>
Gouvernement du Canada | Government of Canada<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 clear="all"><br>-- <br>Philip Lowman<br>