If there was some way for CMake to utilize "solution folders" in Visual Studio, we could easily organize unit tests into a hierarchy. This way the solution explorer would not be cluttered and we'd still be able to have 1 project per unit test.<br>
<br><div class="gmail_quote">On Thu, Apr 2, 2009 at 4:03 PM, Daniel Blezek <span dir="ltr"><<a href="mailto:Blezek.Daniel@mayo.edu">Blezek.Daniel@mayo.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size:11pt">Hi Robert,<br>
<br>
I don’t have any suggestions about the compile time unit tests, but we’ve been using the Google testing framework for the last 6 months and have been very happy with it. I wrote up some details related to ITK here:<br>
<br>
<a href="http://www.itk.org/Wiki/Proposals:Increasing_ITK_Code_Coverage#Google_Test" target="_blank">http://www.itk.org/Wiki/Proposals:Increasing_ITK_Code_Coverage#Google_Test</a><br>
<br>
You can have multiple tests embedded in one executable, which is what the gtest framework does.<br>
<br>
Best regards,<br>
-dan <br><div><div></div><div class="h5">
<br>
<br>
On 4/2/09 3:00 PM, "Robert Dailey" <<a href="http://rcdailey@gmail.com" target="_blank">rcdailey@gmail.com</a>> wrote:<br>
<br>
</div></div></span></font><blockquote><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size:11pt"><div><div></div><div class="h5">Hi,<br>
<br>
Currently we have a directory called "test" under each project we have. Each source file (CPP) results in 1 unit test project being created. So if we have a project named "foobar", it would be structured like this on the filesystem:<br>
<br>
foobar/test/test1.cpp<br>
foobar/test/test2.cpp<br>
foobar/test/test3.cpp<br>
<br>
And the generated visual studio projects (when created via CMake) would be:<br>
<br>
foobar<br>
foobar_test1<br>
foobar_test2<br>
foobar_test3<br>
<br>
Obviously this creates a lot of clutter in the solution explorer window in Visual Studio. Is there a more recommended practice for structuring unit tests in CMake? Personal advice is also welcome. One approach I'd like to take is where we only have two projects:<br>
<br>
foobar<br>
foobar_test<br>
<br>
And inside foobar_test, all of the sources under the /test/ directory would be included, so a single project compiles all unit tests.<br>
<br>
foobar_test<br>
test1.cpp<br>
test2.cpp<br>
test3.cpp<br>
<br>
However, the reason why I'm currently not doing this is because of compile-time unit testing. Basically, some unit tests are designed to be successful if they fail to compile. For example, perhaps certain template parameters do not meet the requirements of a specific C++ concept, and thus rightfully fail. This unit test would be considered successful because we want to make sure that ONLY types matching this specific concept are accepted by the compiler.<br>
<br>
If we include these source files in the same project, then it interrupts the whole compilation process. They have to be separate in order to work properly.<br>
<br>
</div></div><hr align="CENTER" size="3" width="95%"></span></font><font size="2"><font face="Consolas, Courier New, Courier"><span style="font-size:10pt">_______________________________________________<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>
</span></font></font></blockquote><font size="2"><font face="Consolas, Courier New, Courier"><span style="font-size:10pt"><br>
</span></font></font><font face="Calibri, Verdana, Helvetica, Arial"><span style="font-size:11pt">-- <br>
<b>Daniel Blezek, PhD<br>
</b>Medical Imaging Informatics Innovation Center<br>
<br>
P 127 or (77) 8 8886<br>
T 507 538 8886<br>
E <a href="http://blezek.daniel@mayo.edu" target="_blank">blezek.daniel@mayo.edu</a><br>
<br>
Mayo Clinic<br>
200 First St. S.W.<br>
Harwick SL-44<br>
Rochester, MN 55905<br>
<a href="http://mayoclinic.org" target="_blank">mayoclinic.org</a><br>
<br>
</span></font>
</div>
</blockquote></div><br>