[CMake] Test-specific configuration

Andreas Naumann Andreas-Naumann at gmx.net
Tue Jun 21 01:03:35 EDT 2011


Am 21.06.2011 02:50, schrieb Tim Gallagher:
> Hi,
>
> I'm trying to set up automated testing of our code with CTest (we are using CMake), but I'm running into some issues I can't figure out the correct way to solve. Many of our tests require specific sets of options to be turned on/off in the configuration step.
>
> How is this done? We've used CTest for a much simpler code and there we created a bunch of different driver programs for unit tests that we added with add_executable() and add_test(), but there were no configuration options that changed for each test.
>
> In this case, if we have, say, 10 tests, each test will need a configure/build/run step with different options for configuration. What needs to go in the CMakeLists.txt?
>
> These will be submitted to CDash also, if that changes things.
>
> Any help would be appreciated.
>
> Tim
> _______________________________________________
> 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
>
>    
Hi Tim,

the configurations differ in compileflags or compiledefinitions only, right?

So you could add different executables for each compileflag definition:
add_executable(test_${config} SOURCES)
set_target_properties(test_${config} COMPILEFLAGS ${CURRENTFLAGS})

or use different build directories for each configuration, configure 
with cmake and then run ctest in each directory.

Andreas


More information about the CMake mailing list