From 747021e0c89d50f93ded1c9809fd33e14a4b3575 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 2 Mar 2014 04:15:33 +0100 Subject: [PATCH] CMake: detect GTest if it is installed --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a38af9c37..c80f1d6f13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ ######################################## # General setup # -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) option(ANDROID "Enables a build for Android" OFF) option(USE_EGL "Enables EGL OpenGL Interface" OFF) @@ -331,6 +331,14 @@ if(NOT OPENMP_FOUND) message("OpenMP parallelization disabled") endif() +include(FindGTest OPTIONAL) +if(GTEST_FOUND) + include_directories(${GTEST_INCLUDE_DIRS}) + message("GTest found, unit tests can be compiled and ran with 'ctest'") +else() + message("GTest NOT found, disabling unit tests") +endif(GTEST_FOUND) + if(NOT ANDROID) include(FindOpenGL)