This commit is contained in:
Fabio Bas 2015-10-08 21:33:24 +02:00
parent 3ebe42c400
commit 7fe60279de
7 changed files with 56 additions and 38 deletions

View file

@ -233,27 +233,9 @@ if(WITH_ORACLE)
SET(CPACK_INSTALL_CMAKE_PROJECTS "release/oracle.app;oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
endif()
if(test)
find_package(Gtest REQUIRED)
if(GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS})
else()
message(STATUS "Downloading googletest")
configure_file(gtest-CMakeLists.txt gtest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/gtest-download )
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/gtest-download )
# Add gtest directly to our build
add_subdirectory(${CMAKE_BINARY_DIR}/gtest-src
${CMAKE_BINARY_DIR}/gtest-build
EXCLUDE_FROM_ALL )
# Add the gtest include directory, since gtest
# doesn't add that dependency to its gtest target
target_include_directories(gtest INTERFACE
"${CMAKE_BINARY_DIR}/gtest-src/include" )
endif()
enable_testing()
# Compile tests (default off)
option(WITH_TESTS "build tests" OFF)
if(WITH_TESTS)
include(CTest)
add_subdirectory(tests)
endif()