CMake: detect GTest if it is installed

This commit is contained in:
Pierre Bourdon 2014-03-02 04:15:33 +01:00
parent 0942bdae1c
commit 747021e0c8
1 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,7 @@
######################################## ########################################
# General setup # General setup
# #
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8)
option(ANDROID "Enables a build for Android" OFF) option(ANDROID "Enables a build for Android" OFF)
option(USE_EGL "Enables EGL OpenGL Interface" OFF) option(USE_EGL "Enables EGL OpenGL Interface" OFF)
@ -331,6 +331,14 @@ if(NOT OPENMP_FOUND)
message("OpenMP parallelization disabled") message("OpenMP parallelization disabled")
endif() 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) if(NOT ANDROID)
include(FindOpenGL) include(FindOpenGL)