The add_akonadi_isolated_test CMake macro was searching for akonaditest using find_program. This is the right thing to do when the macro is called by a separate project that uses akonadi, since then it is already in the system as a required dependency.
However, this will not work when building akonadi itself for the first time, where akonadi is not installed in the system yet. akonaditest will not be found, since it will be built and installed by this same project, and that's at make time, long after this macro runs.
This patch checks if we're building akonadi itself, and if so, it sets the test runner as just "akonaditest". When using the add_test(NAME foo COMMAND akonaditest) syntax, CMake will detect that it's a target name and replace it with the location of the executable that will be built.