[CMake] Associating a single build step with multiple sub-projects in CDash

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Tue Sep 29 10:01:49 EDT 2015


Dear All,

After the suggestion from Bill Hoffman, I played with CDash for a while now. I was able to create a ctest script that would build the packages/subdirectories of my project one by one, and then upload the build/test results to a CDash server. With the results being quite user friendly on the webpage.

However this is unfortunately terribly slow. The project that I'm trying to build as an exercise has ~120 packages/subdirectories. Each with 1-20 source files. As you can imagine there's a huge difference between calling "make" just once to let all targets build at the same time, or to call it 120 times for the separate packages. The CPU utilisation in the latter case is less than 50% overall. (With the "Unix Makefiles" generator it's around 30%, and with Ninja around 50%. On an machine with 8 threads.)

But I noticed that when I build the project with CTEST_USE_LAUNCHERS enabled, even in a fully parallel build the output generated by CTest/CMake associates the build warnings/errors with the labels that I gave to the targets in my build. (Which correspond to the names of the packages.)

Unfortunately however I'm unable to upload the results from this single build step to CDash such that the warnings/errors belonging to the different sub-projects would show up under those sub-projects. :-( I tried this with the following code:

# Execute the project build:
ctest_build( BUILD ${CTEST_BINARY_DIRECTORY} APPEND )

# The subprojects to build/test:
set( _subprojects @CTEST_PROJECT_SUBPROJECTS@ )
foreach( _subproject ${_subprojects} )

   # Upload the build results for this package:
   set_property( GLOBAL PROPERTY SubProject Package_${_subproject} )
   set_property( GLOBAL PROPERTY Label Package_${_subproject} )
   set( CTEST_BUILD_TARGET Package_${_subproject} )
   ctest_submit( PARTS Build )

   # Execute the test(s) of the subproject:
   ctest_test( BUILD ${CTEST_BINARY_DIRECTORY}
      INCLUDE_LABEL Package_${_subproject} APPEND )
   ctest_submit( PARTS Test )

endforeach()

But this doesn't do what I was hoping for. (No filtering is made from the one big XML to just pick out the warnings/errors belonging to the currently processed package.)

Now, the current situation is already a lot better than I was in a few days ago. As the XML files generated by ctest in this case seem like a very good starting point to process using our nightly build system to present the warnings/errors on our privately produced webpages. But I wonder if it could be possible to also teach CTest/CDash how to do this sort of thing out of the box...

Cheers,
            Attila


More information about the CMake mailing list