Hi, 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:
foobar/test/test1.cpp foobar/test/test2.cpp foobar/test/test3.cpp And the generated visual studio projects (when created via CMake) would be: foobar foobar_test1 foobar_test2 foobar_test3 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: foobar foobar_test And inside foobar_test, all of the sources under the /test/ directory would be included, so a single project compiles all unit tests. foobar_test test1.cpp test2.cpp test3.cpp 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. 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.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake