Making QtTest optional
Albert Astals Cid
aacid at kde.org
Fri May 30 13:32:13 UTC 2014
El Dimarts, 27 de maig de 2014, a les 22:51:03, Alex Merry va escriure:
> On 27/05/14 13:14, Michael Palimaka wrote:
> > Hi,
> >
> > In most projects ported to KF5 with tests, I see that Qt5Test is being
> > hard-required regardless of whether tests are being built or not.
> > It's not a big issue, but it's not strictly correct either.
> >
> > In a couple of workspaces projects the following approach is used:
> >
> > find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
> > set_package_properties(Qt5Test PROPERTIES
> >
> > PURPOSE "Required for tests"
> > TYPE OPTIONAL
> > )
> >
> > add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
> > if (NOT Qt5Test_FOUND)
> >
> > set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
> >
> > endif()
> >
> > Frameworks uses a different approach because of unified test locations,
> > but Qt5Test will only be pulled in if tests are built.
> >
> > Any thoughts?
>
> I think the current "best practice" for Frameworks is to make the
> add_subdirectory(autotests) conditional on BUILD_TESTING being set, and
> put the find_package(Qt5Test) in autotests/CMakeLists.txt. See, for
> example, KService.
I disagree not building tests can be considered "best practice"? The best
practice is always bulding and running the tests. How are you going to make
sure they pass if you don't even build them?
Cheers,
Albert
>
> However, not all the frameworks have been changed to do this yet.
>
> Alex
>
> _______________________________________________
> Kde-buildsystem mailing list
> Kde-buildsystem at kde.org
> https://mail.kde.org/mailman/listinfo/kde-buildsystem
More information about the Kde-buildsystem
mailing list