Skip to content

Commit 141ddef

Browse files
committed
Fixes version selection of GTest
1 parent 2eccc8f commit 141ddef

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

tests/CMakeLists.txt

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,24 @@ cmake_minimum_required(VERSION 3.0)
22

33
# Package Management using Hunter
44
include("cmake/HunterGate.cmake")
5-
6-
if ( WIN32 AND ( MSVC_TOOLSET_VERSION LESS 140 ) )
7-
# Visual Studio < 2015
8-
# GTest 1.8.0
9-
HunterGate(
10-
URL "https://github.com/cpp-pm/hunter/archive/v0.23.222.tar.gz"
11-
SHA1 "0b88baaa2a9a35b8ce632c57ade66be8dd918afd"
12-
)
13-
set( GTEST_MAIN GTest::main )
14-
else()
15-
# GTest 1.8.1
16-
HunterGate(
17-
URL "https://github.com/cpp-pm/hunter/archive/v0.23.224.tar.gz"
18-
SHA1 "18e57a43efc435f2e1dae1291e82e42afbf940be"
19-
)
20-
set( GTEST_MAIN GTest::gtest_main )
21-
endif()
5+
HunterGate(
6+
URL "https://github.com/cpp-pm/hunter/archive/v0.23.224.tar.gz"
7+
SHA1 "18e57a43efc435f2e1dae1291e82e42afbf940be"
8+
LOCAL
9+
)
2210

2311
project(HttpStatusCodesTests)
2412

2513
set (CMAKE_CXX_STANDARD 11)
2614

2715
hunter_add_package(GTest)
2816
find_package(GTest CONFIG REQUIRED)
17+
message( "GTest_VERSION: ${GTest_VERSION}" )
18+
if( GTest_VERSION VERSION_LESS "1.9.0" )
19+
set( GTEST_MAIN GTest::main )
20+
else()
21+
set( GTEST_MAIN GTest::gtest_main )
22+
endif()
2923

3024
enable_testing()
3125

tests/cmake/Hunter/config.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
if ( WIN32 AND ( MSVC_TOOLSET_VERSION LESS 140 ) )
3+
# Visual Studio < 2015
4+
hunter_config( GTest VERSION 1.8.0-hunter-p11 )
5+
else()
6+
hunter_config( GTest VERSION 1.8.1 ) # Actually, this results in GTest version 1.9.0
7+
endif()

0 commit comments

Comments
 (0)