EXECUTABLE_OUTPUT_PATH for tests

Alexander Neundorf neundorf at kde.org
Thu Sep 20 01:21:46 CEST 2007


On Wednesday 19 September 2007 18:55, Andreas Pakulat wrote:
> On 19.09.07 18:40:16, Alexander Neundorf wrote:
> > currently KDE4_ADD_TEST_EXECUTABLE and KDE4_ADD_UNIT_TEST set
> > EXECUTABLE_OUTPUT_PATH back from bin/ to the current directory.
> >
> > I think this is a bad idea in general.
>
> In general maybe, but within kde I think its quite ok.

Ok, so we disagree here.

> > Imagine this cmake code:
> >
> > add_executable(foo main.cpp)
> > add_executable(bar bar.c)
>
> Tests in kdelibs, kdepimlibs and other modules are in a separate
> subdirectory with a separate CMakeLists.txt. Nearly all tests I
> converted when adding these two macros were setting
> EXECUTABLE_OUTPUT_PATH in that CMakeLists.txt.

I think this is better, it makes obvious what is going on.
This is about readability and long term maintainability.
Reading SET(EXECUTABLE_OUTPUT_PATH wherever/) makes it very clear what 
happens, without requiring additional knowledge.
It is just one simple line of code. This is somewhat similar to many of the 
changes in Qt4, where all-in-one-line ctors with many arguments were replaced 
by a simple ctor and multiple simple do-one-obvious-thing functions.

What we have now is a hidden side effect by setting a (more or less) global 
variable in some seemingly unrelated function.

> This is something that at least kdelibs developers want, putting the
> tests into the current directory as that way you can easily check bin/
> to see which binaries are going to be installed.

I don't see the significant value in this and it is only partly true. With the 
example above also foo and bar wouldn't appear in bin/, while they can have 
install rules.
If it helps we could automatically put a "test_" prefix in front/at the end of 
all test executables to make this obvious.

Alex


More information about the Kde-buildsystem mailing list