From 06c852e9080b65da26d3fa84dc3d3a6c07b206d5 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 5 Sep 2019 13:29:46 +0200 Subject: [PATCH] Make it possible to opt out of building tests --- CMakeLists.txt | 7 ++++++- lib/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0f68da..ef95484 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,14 @@ cmake_minimum_required(VERSION 3.6) project(linuxdeploy-plugin-qt) +include(CTest) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_subdirectory(lib) add_subdirectory(src) -add_subdirectory(tests) + +if (BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index abd5a72..22ee008 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory(linuxdeploy EXCLUDE_FROM_ALL) -if(NOT TARGET gtest) +if(NOT TARGET gtest AND BUILD_TESTING) add_subdirectory(googletest EXCLUDE_FROM_ALL) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fefa129..032461a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,3 @@ -enable_testing() - add_executable(linuxdeploy-plugin-qt-tests test_main.cpp test_deploy_qml.cpp ../src/qml.cpp) target_link_libraries(linuxdeploy-plugin-qt-tests linuxdeploy_core args json gtest) target_compile_definitions(linuxdeploy-plugin-qt-tests PRIVATE TESTS_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")