[CMake] CTest / CDash integration

Clinton Stimpson clinton at elemtech.com
Tue Apr 9 11:03:58 EDT 2013


On Tuesday, April 09, 2013 04:42:57 PM Martin Baute wrote:
> Am 09.04.2013 16:29, schrieb Clinton Stimpson:
> > How are the config settings and binary path for CTest already given
> > in the
> > CMakeLists.txt file?  Normally, a CMakeLists.txt file does not have a
> > hardcoded binary path, nor does it have fixed config settings.
> 
> Wrong wording, sorry. They are, after successful configuration, in the
> CMakeCache.txt. Now I'm facing two options regarding CTest:
> 
> - Doing incremental builds only, omitting information e.g. on the
> number
>    of compiler warnings from the data sent to CDash.
> 
> - Wiping the binary directory clean - including the platform-specific
>    configuration.
> 
> Now, I could set up a CTest script that does the CMake configuration
> for me. As it's platform specific, it would have to have lots of if /
> else constructs, duplicating most of what CMakeLists.txt does. OR I
> could create a CTestScript.cmake.in and forward the necessary settings
> from CMakeLists.txt (using configure_file()).
> 
> All this strikes me as somehow needlessly complicated when lots of the
> necessary settings *could* be handled by the code that I add when I say
> "include( CTest )". Add to that the somewhat lackluster documentation
> of CTest itself (no variable docs, several command-line options under-
> documented etc.), and I get the feeling that I'm simply *missing*
> something, like, a crucial page in the Wiki or an integration guide
> or somesuch. From what I've seen from the CMake / CTest / CDash trinity
> so far, it's really big on "out of the box" functionality, which is why
> I find this issue so confusing.
> 
> Regards,

Perhaps it would help if I explained these 2 different ways of using CTest.

1. non scripted mode
$ cmake /path/to/source
$ ctest -D Experimental

This goes through the start/configure/build/test/submit phases using 
information from the CMakeLists.txt and CMakeCache.txt files.
In other words, CMake information is given to CTest.


2. scripted mode
$ ctest -S myscript.cmake

where myscript.cmake could simply go through the 
start/configure/build/test/submit phases, or it can do more complex things.

You'll also notice that I did not run cmake manually to set up the build tree.  
That is driven by myscript.cmake.  That is the reason the config settings and 
the binary path go in myscript.cmake, because it is driving.
In other words, CTest information is given to CMake.
When used this way, I would not try to reverse that and feed CMake information 
into CTest.


Apart from #1 and #2... the include(CTest) and add_test() commands in the 
CMakeLists.txt files only generate information files for use by CTest in 
scenario #1 or #2.  It is to bridge the CTest and CMake tools (which can be 
used independently).

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list