[patch] cmake add_test

Manuel Breugelmans mbr.nxi at gmail.com
Fri Aug 29 17:26:51 UTC 2008


On Thursday 28 August 2008 23:34:08 you wrote:
> Currently some add_test do not get communicated correctly by the CMake
> buildmanager. CMakeProjectVisitor overwrites target types if the 'add_test'
> is in front the 'add_executable' for a test target. Attached a patch that
> exposes the problem and fixes it.
>
> OK to commit this, Aliex/Matt?
>

Right, totally forget the above, the problem is much worse. KDevelop's 
handling of 'add_test' linked to TestTargetItem is based on the assumption 
that there is always an actual CMake target (in the form of add_executable) 
around. This assumption is wrong :( I fear it is broken by design atm.

According to the CMake manual `add_test(foo foo.exe -bla -blah)' just says: 
look, foo.exe is a test executable, please execute it with said flags. foo.exe 
needn't be built by the project at all. Indeed I suppose it's not uncommon to 
have test scripts.

Linking a test with a target _only_ works in the KDE4 case, where the 
'kde4_add_unit_test' macro wraps an add_executable + add_test call for a 
QTEST_MAIN generated QTest.


Manuel




More information about the KDevelop-devel mailing list