changeset 157:a63fb54819d7

gtest on debian sid
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Oct 2012 14:05:29 +0200
parents a660e18b2360
children 00604c758004
files CMakeLists.txt Resources/CMake/GoogleTestConfiguration.cmake
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Oct 23 16:01:39 2012 +0200
+++ b/CMakeLists.txt	Fri Oct 26 14:05:29 2012 +0200
@@ -19,7 +19,7 @@
 SET(USE_DYNAMIC_GOOGLE_TEST ON CACHE BOOL "Use the dynamic version of Google Test (not for Debian sid)")
 SET(USE_DYNAMIC_SQLITE ON CACHE BOOL "Use the dynamic version of SQLite")
 SET(DEBIAN_FORCE_HARDENING OFF CACHE BOOL "Force the injection of Debian hardening flags (unrecommended)")
-SET(DEBIAN_USE_STATIC_GOOGLE_TEST OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
+SET(DEBIAN_USE_GTEST_SOURCE_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (only for Debian sid)")
 
 mark_as_advanced(USE_DYNAMIC_JSONCPP)
 mark_as_advanced(USE_DYNAMIC_GOOGLE_LOG)
--- a/Resources/CMake/GoogleTestConfiguration.cmake	Tue Oct 23 16:01:39 2012 +0200
+++ b/Resources/CMake/GoogleTestConfiguration.cmake	Fri Oct 26 14:05:29 2012 +0200
@@ -1,5 +1,11 @@
-if (DEBIAN_USE_STATIC_GOOGLE_TEST)
-  message(FATAL_ERROR "todo")
+if (DEBIAN_USE_GTEST_SOURCE_PACKAGE)
+  set(GTEST_SOURCES /usr/src/gtest/src/gtest-all.cc)
+  include_directories(/usr/src/gtest)
+
+  if (NOT EXISTS /usr/include/gtest/gtest.h OR
+      NOT EXISTS ${GTEST_SOURCES})
+    message(FATAL_ERROR "Please install the libgtest-dev package")
+  endif()
 
 elseif (STATIC_BUILD OR NOT USE_DYNAMIC_GOOGLE_TEST)
   SET(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.6.0)
@@ -16,6 +22,10 @@
 
 else()
   include(FindGTest)
+  if (NOT GTEST_FOUND)
+    message(FATAL_ERROR "Unable to find GoogleTest")
+  endif()
+
   include_directories(${GTEST_INCLUDE_DIRS})
   link_libraries(${GTEST_LIBRARIES})
 endif()