mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
Add dummy googletest
Uses the built in cmake -Dtest=ON It should download googletest on the fly if needed. Adds a new make target, `make test` Ref #167
This commit is contained in:
parent
cd02df78a1
commit
3ebe42c400
6 changed files with 75 additions and 6 deletions
|
|
@ -232,3 +232,28 @@ if(WITH_ORACLE)
|
|||
add_subdirectory(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()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue