From 3629a8033ddac0b63c05ee19283baea0cf323a2d Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 2 Jun 2016 23:36:42 +0300 Subject: [PATCH] Building tests only if GTest is found --- libuavcan/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libuavcan/CMakeLists.txt b/libuavcan/CMakeLists.txt index d27c89d68c..7d23d707b0 100644 --- a/libuavcan/CMakeLists.txt +++ b/libuavcan/CMakeLists.txt @@ -139,10 +139,15 @@ if (DEBUG_BUILD) add_dependencies(uavcan_optim libuavcan_dsdlc) # GTest executables - find_package(GTest REQUIRED) - add_libuavcan_test(libuavcan_test uavcan "") # Default - add_libuavcan_test(libuavcan_test_cpp03 uavcan_cpp03 "${cpp03_flags}") # C++03 - add_libuavcan_test(libuavcan_test_optim uavcan_optim "${optim_flags}") # Max optimization + find_package(GTest) + if (GTEST_FOUND) + message(STATUS "GTest found, tests will be built and run [${GTEST_INCLUDE_DIRS}] [${GTEST_BOTH_LIBRARIES}]") + add_libuavcan_test(libuavcan_test uavcan "") # Default + add_libuavcan_test(libuavcan_test_cpp03 uavcan_cpp03 "${cpp03_flags}") # C++03 + add_libuavcan_test(libuavcan_test_optim uavcan_optim "${optim_flags}") # Max optimization + else (GTEST_FOUND) + message(STATUS "GTest was not found, tests will not be built") + endif (GTEST_FOUND) else () message(STATUS "Release build type: " ${CMAKE_BUILD_TYPE}) endif ()