refact: Move GTest to third_party folder

This commit is contained in:
jackfiled 2024-03-01 17:00:12 +08:00
parent 7ed762bd87
commit 07cd523514
225 changed files with 20 additions and 23 deletions

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.10) # cmakecmake cmake_minimum_required(VERSION 3.10) # cmakecmake
add_subdirectory(third_party/GTest)
add_subdirectory(test) add_subdirectory(test)
add_subdirectory(all_test) add_subdirectory(all_test)

View File

@ -3,10 +3,6 @@ project(bus_test)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
add_subdirectory(./GTest)
include_directories(GTest/googletest/include)
include_directories(GTest/googlemock/include)
include_directories(../include) include_directories(../include)
aux_source_directory("../src/" SRCS) aux_source_directory("../src/" SRCS)

View File

@ -26,7 +26,7 @@ option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
if(BUILD_GMOCK) if(BUILD_GMOCK)
add_subdirectory( googlemock ) add_subdirectory(googlemock)
else() else()
add_subdirectory( googletest ) add_subdirectory(googletest)
endif() endif()

View File

@ -90,13 +90,13 @@ if (MSVC)
cxx_library(gmock cxx_library(gmock
"${cxx_strict}" "${cxx_strict}"
"${gtest_dir}/src/gtest-all.cc" "${gtest_dir}/src/gtest-all.cc"
src/gmock-all.cc) src/gmock-all.cc)
cxx_library(gmock_main cxx_library(gmock_main
"${cxx_strict}" "${cxx_strict}"
"${gtest_dir}/src/gtest-all.cc" "${gtest_dir}/src/gtest-all.cc"
src/gmock-all.cc src/gmock-all.cc
src/gmock_main.cc) src/gmock_main.cc)
else() else()
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc) cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest) target_link_libraries(gmock PUBLIC gtest)

View File

@ -199,21 +199,21 @@ if (gtest_build_tests)
cxx_test(gtest_no_test_unittest gtest) cxx_test(gtest_no_test_unittest gtest)
cxx_test(googletest-options-test gtest_main) cxx_test(googletest-options-test gtest_main)
cxx_test(googletest-param-test-test gtest cxx_test(googletest-param-test-test gtest
test/googletest-param-test2-test.cc) test/googletest-param-test2-test.cc)
cxx_test(googletest-port-test gtest_main) cxx_test(googletest-port-test gtest_main)
cxx_test(gtest_pred_impl_unittest gtest_main) cxx_test(gtest_pred_impl_unittest gtest_main)
cxx_test(gtest_premature_exit_test gtest cxx_test(gtest_premature_exit_test gtest
test/gtest_premature_exit_test.cc) test/gtest_premature_exit_test.cc)
cxx_test(googletest-printers-test gtest_main) cxx_test(googletest-printers-test gtest_main)
cxx_test(gtest_prod_test gtest_main cxx_test(gtest_prod_test gtest_main
test/production.cc) test/production.cc)
cxx_test(gtest_repeat_test gtest) cxx_test(gtest_repeat_test gtest)
cxx_test(gtest_sole_header_test gtest_main) cxx_test(gtest_sole_header_test gtest_main)
cxx_test(gtest_stress_test gtest) cxx_test(gtest_stress_test gtest)
cxx_test(googletest-test-part-test gtest_main) cxx_test(googletest-test-part-test gtest_main)
cxx_test(gtest_throw_on_failure_ex_test gtest) cxx_test(gtest_throw_on_failure_ex_test gtest)
cxx_test(gtest-typed-test_test gtest_main cxx_test(gtest-typed-test_test gtest_main
test/gtest-typed-test2_test.cc) test/gtest-typed-test2_test.cc)
cxx_test(gtest_unittest gtest_main) cxx_test(gtest_unittest gtest_main)
cxx_test(gtest-unittest-api_test gtest) cxx_test(gtest-unittest-api_test gtest)
cxx_test(gtest_skip_in_environment_setup_test gtest_main) cxx_test(gtest_skip_in_environment_setup_test gtest_main)
@ -225,12 +225,12 @@ if (gtest_build_tests)
# MSVC 7.1 does not support STL with exceptions disabled. # MSVC 7.1 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310) if (NOT MSVC OR MSVC_VERSION GREATER 1310)
cxx_library(gtest_no_exception "${cxx_no_exception}" cxx_library(gtest_no_exception "${cxx_no_exception}"
src/gtest-all.cc) src/gtest-all.cc)
cxx_library(gtest_main_no_exception "${cxx_no_exception}" cxx_library(gtest_main_no_exception "${cxx_no_exception}"
src/gtest-all.cc src/gtest_main.cc) src/gtest-all.cc src/gtest_main.cc)
endif() endif()
cxx_library(gtest_main_no_rtti "${cxx_no_rtti}" cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
src/gtest-all.cc src/gtest_main.cc) src/gtest-all.cc src/gtest_main.cc)
cxx_test_with_flags(gtest-death-test_ex_nocatch_test cxx_test_with_flags(gtest-death-test_ex_nocatch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0" "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
@ -243,7 +243,7 @@ if (gtest_build_tests)
gtest_main_no_rtti test/gtest_unittest.cc) gtest_main_no_rtti test/gtest_unittest.cc)
cxx_shared_library(gtest_dll "${cxx_default}" cxx_shared_library(gtest_dll "${cxx_default}"
src/gtest-all.cc src/gtest_main.cc) src/gtest-all.cc src/gtest_main.cc)
cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}" cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}"
gtest_dll test/gtest_all_test.cc) gtest_dll test/gtest_all_test.cc)
@ -266,14 +266,14 @@ if (gtest_build_tests)
googletest-catch-exceptions-no-ex-test_ googletest-catch-exceptions-no-ex-test_
"${cxx_no_exception}" "${cxx_no_exception}"
gtest_main_no_exception gtest_main_no_exception
test/googletest-catch-exceptions-test_.cc) test/googletest-catch-exceptions-test_.cc)
endif() endif()
cxx_executable_with_flags( cxx_executable_with_flags(
googletest-catch-exceptions-ex-test_ googletest-catch-exceptions-ex-test_
"${cxx_exception}" "${cxx_exception}"
gtest_main gtest_main
test/googletest-catch-exceptions-test_.cc) test/googletest-catch-exceptions-test_.cc)
py_test(googletest-catch-exceptions-test) py_test(googletest-catch-exceptions-test)
cxx_executable(googletest-color-test_ test gtest) cxx_executable(googletest-color-test_ test gtest)

View File

@ -312,7 +312,7 @@ endfunction()
# Installs the specified targets and configures the associated pkgconfig files. # Installs the specified targets and configures the associated pkgconfig files.
function(install_project) function(install_project)
if(INSTALL_GTEST) if(INSTALL_GTEST)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" install(DIRECTORY "../../../../include"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# Install the project targets. # Install the project targets.
install(TARGETS ${ARGN} install(TARGETS ${ARGN}

Some files were not shown because too many files have changed in this diff Show More