mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 09:03:47 +00:00
feature(testing-automation): unit tests with Google Framework (#3273)
This commit is contained in:
20
src/cmake/googletest-download.cmake
Normal file
20
src/cmake/googletest-download.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
# code copied from https://crascit.com/2015/07/25/cmake-gtest/
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(
|
||||
googletest
|
||||
SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src"
|
||||
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build"
|
||||
GIT_REPOSITORY
|
||||
https://github.com/google/googletest.git
|
||||
GIT_TAG
|
||||
release-1.10.0
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
32
src/cmake/googletest.cmake
Normal file
32
src/cmake/googletest.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
# the following code to fetch googletest
|
||||
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/
|
||||
# download and unpack googletest at configure time
|
||||
|
||||
macro(fetch_googletest _download_module_path _download_root)
|
||||
set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root})
|
||||
configure_file(
|
||||
${_download_module_path}/googletest-download.cmake
|
||||
${_download_root}/CMakeLists.txt
|
||||
@ONLY
|
||||
)
|
||||
unset(GOOGLETEST_DOWNLOAD_ROOT)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
|
||||
# adds the targers: gtest, gtest_main, gmock, gmock_main
|
||||
add_subdirectory(
|
||||
${_download_root}/googletest-src
|
||||
${_download_root}/googletest-build
|
||||
)
|
||||
endmacro()
|
||||
@@ -40,6 +40,12 @@ else()
|
||||
message("* Build map/vmap tools : No (default)")
|
||||
endif()
|
||||
|
||||
if( UNIT_TESTS )
|
||||
message("* Build unit tests : Yes")
|
||||
else()
|
||||
message("* Build unit tests : No (default)")
|
||||
endif()
|
||||
|
||||
if( USE_COREPCH )
|
||||
message("* Build core w/PCH : Yes (default)")
|
||||
else()
|
||||
|
||||
Reference in New Issue
Block a user