Making QtTest optional

Michael Palimaka kensington at gentoo.org
Tue May 27 12:14:04 UTC 2014


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?

Best regards,
Michael



More information about the Kde-buildsystem mailing list