diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15a02d707..fe1e5ceda 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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') diff --git a/.gitmodules b/.gitmodules index 3694e06f0..19a31943c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c01861df..796116f63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/googletest b/lib/googletest new file mode 160000 index 000000000..8d51dc50e --- /dev/null +++ b/lib/googletest @@ -0,0 +1 @@ +Subproject commit 8d51dc50eb7e7698427fed81b85edad0e032112e diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 017b72149..61e583f42 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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