From 4a76e7d71be4ad89eeb17cd6fc1868808812b481 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sat, 18 Jul 2015 11:25:51 +0200 Subject: [PATCH] add googletest module --- modules/googletest.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/googletest.cmake diff --git a/modules/googletest.cmake b/modules/googletest.cmake new file mode 100644 index 0000000..97c84d0 --- /dev/null +++ b/modules/googletest.cmake @@ -0,0 +1,33 @@ +#.rst: +# +# Includes Google Test sources and adds a library "googletest". +# +# Variables used:: +# +# GOOGLETEST_ROOT +# +# Example autocmake.cfg entry:: +# +# [googletest] +# source: https://github.com/scisoft/autocmake/raw/master/modules/googletest.cmake +# define: '-DGOOGLETEST_ROOT=external/googletest' + +set(GOOGLETEST_ROOT external/googletest CACHE STRING "Google Test source root") + +message(STATUS "GOOGLETEST_ROOT set to ${GOOGLETEST_ROOT}") + +include_directories( + ${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT} + ${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/include + ) + +set(GOOGLETEST_SOURCES + ${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest-all.cc + ${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest_main.cc + ) + +foreach(_source ${GOOGLETEST_SOURCES}) + set_source_files_properties(${_source} PROPERTIES GENERATED 1) +endforeach() + +add_library(googletest ${GOOGLETEST_SOURCES})