[CMake] Need advice for unit test structure
Paul Oppenheim (Poppy Linden)
poppy at lindenlab.com
Wed Apr 8 18:33:21 EDT 2009
Robert Dailey wrote:
> 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:
>
...
>
> 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.
>
thank goodness! someone else!
I'm currently dealing with the same issue for a large number of reasons
* clutters IDEs
* tests add long compile / link time
* some developers interested in TDD (test-driven development)
* etc
The solution the CMake project itself uses is sub-projects. Since we're only interested in unit tests at the moment, the process of adding targets and tests is quite mechanical, so I have a CMake macro that auto-generates sub-build CMakeFiles.txt files.
I'm currently in mid-development, so this hasn't merged back to trunk yet. Otherwise I'd have a link to the source for you (Second Life is open source). The current good but project-cluttering solution is here:
http://svn.secondlife.com/trac/linden/browser/trunk/indra/cmake/LLAddBuildTest.cmake
(the new stuff will be in the same file)
I'm *really* interested in hearing what you wind up doing!
+ poppy
More information about the CMake
mailing list