Skip to content

Commit 964e1f6

Browse files
authored
Merge pull request #345 from gpospelov/remove-gtest
Remove gtest
2 parents 86c9134 + e6dee74 commit 964e1f6

File tree

15 files changed

+33
-42
lines changed

15 files changed

+33
-42
lines changed

.github/workflows/linux-build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
with:
18-
submodules: true
1917

2018
- name: setup dependencies
2119
run: |
2220
sudo apt-get update
2321
sudo apt-get install -y build-essential cmake ccache \
24-
cmake qt5-default qttools5-dev libqt5svg5-dev qtdeclarative5-dev libx11-xcb1
22+
cmake qt5-default qttools5-dev libqt5svg5-dev qtdeclarative5-dev libx11-xcb1 libgtest-dev
2523
2624
- name: ccache timestamp
2725
id: ccache_cache_timestamp

.github/workflows/macos-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
with:
18-
submodules: true
1917

2018
- name: dependencies
2119
run: |

.github/workflows/windows-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v2
21-
with:
22-
submodules: true
2321

2422
- name: Install Qt
2523
uses: jurplel/install-qt-action@v2

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ Main features of the framework are:
2929
## Requirements
3030

3131
+ C++-17
32-
+ CMake 3.14
33-
+ Qt 5.12
32+
+ CMake >= 3.14
33+
+ Qt >= 5.12
34+
+ gtest >= 1.10
3435

3536
## Installation instructions
3637

3738
```sh
38-
git clone --recurse-submodules https://github.com/gpospelov/qt-mvvm.git
39+
git clone https://github.com/gpospelov/qt-mvvm.git
3940
mkdir ./build; cd ./build
4041
cmake ..; make -j8; ctest
4142

cmake/modules/CodeTools.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ function(project_testcoverage_setup)
4646
)
4747
endfunction()
4848

49+
# Fetches google test version 1.12.1
50+
function(fetch_googletest)
51+
include(FetchContent)
52+
FetchContent_Declare(
53+
googletest
54+
GIT_REPOSITORY https://github.com/google/googletest.git
55+
GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850)
56+
FetchContent_MakeAvailable(googletest)
57+
message(VERBOSE "GTest binaries are present at ${googletest_BINARY_DIR}")
58+
endfunction()
59+
4960
# Setups targets for code processing.
5061

5162
function(project_codetools_setup)

tests/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
enable_testing()
2+
3+
find_package(GTest 1.10 QUIET CONFIG)
4+
if (NOT GTest_FOUND)
5+
message(WARNING "GTest with version >= \"1.10\" was not found, fetching from internet" )
6+
fetch_googletest()
7+
endif()
8+
find_package_message(
9+
GTest_DETAILS
10+
"Found GTest: ${GTest_DIR} (version \"${GTest_VERSION}\")"
11+
"[${GTest_FOUND}][${GTest_DIR}][v${GTest_VERSION}]")
12+
113
include(GoogleTest)
214

315
if(WIN32)

tests/libtestmachinery/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ set(library_name testmachinery)
33
file(GLOB source_files "*.cpp")
44
file(GLOB include_files "*.h")
55

6-
if(WIN32)
7-
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY)
8-
endif()
9-
106
add_library(${library_name} STATIC ${source_files} ${include_files})
11-
target_link_libraries(${library_name} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model)
7+
target_link_libraries(${library_name} PUBLIC GTest::gtest GTest::gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model)
128
target_include_directories(${library_name} PUBLIC
139
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> $<BUILD_INTERFACE:${MVVM_AUTOGEN_DIR}>)
1410

tests/testintegration/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
88

99
set(CMAKE_AUTOMOC ON)
1010
add_executable(${test} ${source_files} ${include_files})
11-
target_link_libraries(${test} gtest gmock Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot)
11+
target_link_libraries(${test} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot)
1212

1313
if (MVVM_DISCOVER_TESTS)
1414
gtest_discover_tests(${test} TEST_PREFIX "Integration.")

tests/testmodel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
88

99
set(CMAKE_AUTOMOC ON)
1010
add_executable(${test} ${source_files} ${include_files})
11-
target_link_libraries(${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model testmachinery)
11+
target_link_libraries(${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model testmachinery)
1212

1313
if (MVVM_DISCOVER_TESTS)
1414
gtest_discover_tests(${test} TEST_PREFIX "Model.")

tests/testview/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
88

99
set(CMAKE_AUTOMOC ON)
1010
add_executable(${test} ${source_files} ${include_files})
11-
target_link_libraries(${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot)
11+
target_link_libraries(${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot)
1212

1313
if (MVVM_DISCOVER_TESTS)
1414
gtest_discover_tests(${test} TEST_PREFIX "View.")

tests/testviewmodel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
88

99
set(CMAKE_AUTOMOC ON)
1010
add_executable(${test} ${source_files} ${include_files})
11-
target_link_libraries(${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_viewmodel testmachinery qcustomplot)
11+
target_link_libraries(${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_viewmodel testmachinery qcustomplot)
1212

1313
if (MVVM_DISCOVER_TESTS)
1414
gtest_discover_tests(${test} TEST_PREFIX "View.")

thirdparty/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
if(BUILD_TESTING)
2-
add_subdirectory(gtest)
3-
endif(BUILD_TESTING)
41
add_subdirectory(qcustomplot)

thirdparty/gtest/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

thirdparty/gtest/googletest

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)