From d4755f53b789c9f828930b701709dae0dd87baa7 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Wed, 29 Aug 2018 13:20:28 +0100 Subject: [PATCH] cmake: build gtest only if dmclock_TEST is ON Signed-off-by: Ricardo Dias --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c394347..d75cdd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,15 +4,6 @@ project(dmclock CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") -if (NOT(TARGET gtest AND TARGET gtest_main)) - if (NOT GTEST_FOUND) - find_package(GTest QUIET) - if (NOT GTEST_FOUND) - include(BuildGTest) - endif() - endif() -endif() - if (NOT(BOOST_FOUND)) find_package(Boost REQUIRED) endif() @@ -33,6 +24,15 @@ endif() option(dmclock_TEST "Generate test targets" ${MASTER_PROJECT}) if(dmclock_TEST) + if (NOT(TARGET gtest AND TARGET gtest_main)) + if (NOT GTEST_FOUND) + find_package(GTest QUIET) + if (NOT GTEST_FOUND) + include(BuildGTest) + endif() + endif() + endif() + enable_testing() add_subdirectory(test) add_subdirectory(support/test)