From 3f9ce4bb995abb7f4577b0af222e81d5fafef9d5 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 9 Apr 2018 00:49:36 +0200
Subject: [PATCH] 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
---
.travis.yml | 2 +-
CMakeLists.txt | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7c32f69b..1178e579 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,7 +23,7 @@ matrix:
env: BUILD_TYPE=Debug
- compiler: gcc
- env: BUILD_TYPE=Debug POLYBAR_BUILD_TYPE=tests
+ env: BUILD_TYPE=Debug POLYBAR_BUILD_TYPE=tests BUILD_TESTS=ON
before_install:
- pip install --user cpp-coveralls
script: ${TRAVIS_BUILD_DIR}/common/travis/tests.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6725b7e..27aa8e20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,9 +28,7 @@ add_subdirectory(src bin)
# We need to enable testing in the root folder so that 'ctest' and 'make test'
# can be run in the build directory
-enable_testing()
if(BUILD_TESTS)
- add_subdirectory(tests)
-else()
+ enable_testing()
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()