Build GoogleTest & GoogleMock as submodules (#3760)

This commit is contained in:
pajlada 2022-05-22 15:43:41 +02:00 committed by GitHub
parent 35a7780564
commit ec4b1627d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 4 deletions

View file

@ -64,8 +64,7 @@ jobs:
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xinerama0 \
libgtest-dev
libxcb-xinerama0
- name: Create build directory (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')

3
.gitmodules vendored
View file

@ -32,3 +32,6 @@
[submodule "lib/magic_enum"]
path = lib/magic_enum
url = https://github.com/Neargye/magic_enum
[submodule "lib/googletest"]
path = lib/googletest
url = https://github.com/google/googletest.git

View file

@ -102,7 +102,18 @@ find_package(RapidJSON REQUIRED)
find_package(Websocketpp REQUIRED)
if (BUILD_TESTS)
find_package(GTest REQUIRED)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/lib/googletest" "lib/googletest")
mark_as_advanced(
BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS
gmock_build_tests gtest_build_samples gtest_build_tests
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols
)
set_target_properties(gtest PROPERTIES FOLDER lib)
set_target_properties(gtest_main PROPERTIES FOLDER lib)
set_target_properties(gmock PROPERTIES FOLDER lib)
set_target_properties(gmock_main PROPERTIES FOLDER lib)
endif ()
if (BUILD_BENCHMARKS)

1
lib/googletest Submodule

@ -0,0 +1 @@
Subproject commit 8d51dc50eb7e7698427fed81b85edad0e032112e

View file

@ -25,7 +25,7 @@ add_sanitizers(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-lib)
target_link_libraries(${PROJECT_NAME} PRIVATE ${GTEST_BOTH_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE gtest gmock)
target_compile_definitions(${PROJECT_NAME} PRIVATE
CHATTERINO_TEST