tests: Only configure tests when asked for

This prevents the download of googletest for normal builds. Now when we
want to compile and run tests we need to specify -DBUILD_TESTS=ON
This commit is contained in:
patrick96 2018-04-09 00:49:36 +02:00 committed by Patrick Ziegler
parent fce313f3ef
commit 3f9ce4bb99
2 changed files with 2 additions and 4 deletions

View File

@ -23,7 +23,7 @@ matrix:
env: BUILD_TYPE=Debug env: BUILD_TYPE=Debug
- compiler: gcc - compiler: gcc
env: BUILD_TYPE=Debug POLYBAR_BUILD_TYPE=tests env: BUILD_TYPE=Debug POLYBAR_BUILD_TYPE=tests BUILD_TESTS=ON
before_install: before_install:
- pip install --user cpp-coveralls - pip install --user cpp-coveralls
script: ${TRAVIS_BUILD_DIR}/common/travis/tests.sh script: ${TRAVIS_BUILD_DIR}/common/travis/tests.sh

View File

@ -28,9 +28,7 @@ add_subdirectory(src bin)
# We need to enable testing in the root folder so that 'ctest' and 'make test' # We need to enable testing in the root folder so that 'ctest' and 'make test'
# can be run in the build directory # can be run in the build directory
enable_testing()
if(BUILD_TESTS) if(BUILD_TESTS)
add_subdirectory(tests) enable_testing()
else()
add_subdirectory(tests EXCLUDE_FROM_ALL) add_subdirectory(tests EXCLUDE_FROM_ALL)
endif() endif()