Make building unit tests optional and default-disabled (option WITH_TESTS).

Authored by markey on May 2 2018, 6:21 PM.

Description

Make building unit tests optional and default-disabled (option WITH_TESTS).

The rationale is that installing gtest and gmock is a big hassle for users
because they must be compiled manually. This is too much to ask from
normal users who are not developers, and it turns people off from building
Amarok.

Details

Committed
markeyMay 2 2018, 6:21 PM
Parents
R181:8a6586da12f9: Fixed fadebars
Branches
Unknown
Tags
Unknown

This is a bit redundant; BUILD_TESTING is defined in KDECMakeSettings.cmake and already used by amarok anyway; you may as well document this variable in building_amarok2_in_home, as it is done in many other KDE projects.

In addition, Qt5Test could be made optional under the same BUILD_TESTING conditional.

markey added a comment.May 4 2018, 8:04 PM

Nope it's not redundant because there is no way to make BUILD_TESTING default to OFF, or is there? You see, that's the whole point, default-disabling the tests.

When you put it like that, yes you're right, The other option I can think of is moving find_package(GoogleMock) to the root CMakeLists.txt and making it non-required, adding tests subdir only if it is found (in addition to BUILD_TESTING=ON. That makes missing gmock non-fatal to users and continues to run the tests on CI with default settings.

markey added a comment.May 5 2018, 3:44 PM

Good idea. Done! :)