[cmake-developers] Unittests with reconfiguration

Brad King brad.king at kitware.com
Mon Apr 27 09:22:17 EDT 2015


On 04/27/2015 07:16 AM, David Cole wrote:
> https://github.com/Kitware/CMake/blob/master/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
> 
> On Mon, Apr 27, 2015 at 4:13 AM, Raffi Enficiaud wrote:
>> I would like to know if it is possible to have a unit test with two runs of
>> cmake, simulating a user change of the cache in between.
>>
>> I am right now looking at RunCMake but I do not think this scheme is
>> suitable for that.

We're trying to make RunCMake able to handle all tests that involve
checking the output and generation results.  Its default behavior
is to use a separate build tree for every case and wipe it out
to start fresh each time.  There are options to change this.  Some
tests do what you need already.  For example, look at

 Tests/RunCMake/configure_file/RunCMakeTest.cmake

for use of RunCMake_TEST_BINARY_DIR and RunCMake_TEST_NO_CLEAN.
The pattern followed there has been repeated several times in
other tests, so it may be worth trying to refactor it out into
some kind of helper.

-Brad



More information about the cmake-developers mailing list