From 490a436ee65ea8644290b21159bded0283857545 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 8 Dec 2020 10:21:45 +0100 Subject: [PATCH 1/4] Remove failing blocklist_driver tests These were tests that fail when the blocklist changes. --- src/test/blocklist_driver.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/blocklist_driver.cpp b/src/test/blocklist_driver.cpp index aa0cb926b..f5f4fa3ac 100644 --- a/src/test/blocklist_driver.cpp +++ b/src/test/blocklist_driver.cpp @@ -34,6 +34,4 @@ TEST(BlocklistDriver, Invalid) int Major, Minor, Patch; EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 25.20.100.7810", Major, Minor, Patch), NULL); EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.7799", Major, Minor, Patch), NULL); - EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 26.20.100.8000", Major, Minor, Patch), NULL); - EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 27.20.100.7900", Major, Minor, Patch), NULL); } From 59cbc01415d0b1fa02454afb2d1c561aa403496d Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 8 Dec 2020 10:02:54 +0100 Subject: [PATCH 2/4] Bump minimum CMake version from 2.8 to 2.8.12 Declare that we're fine with policies up to 3.19.1. This should fix policy errors and "too low cmake_minimal_version() errors" for the forseeable future. --- CMakeLists.txt | 29 ++++++++++---------------- cmake/Download_GTest_CMakeLists.txt.in | 2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 000969d58..9a8722567 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12...3.19.1) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_VERSION}) +endif() set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9 CACHE INTERNAL "") if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.9) @@ -22,23 +25,8 @@ else() message(FATAL_ERROR "Couldn't parse version from src/game/version.h") endif() -if(POLICY CMP0017) - cmake_policy(SET CMP0017 NEW) -endif() - -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif() - -if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) - if(VERSION_PATCH STREQUAL "0") - project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) - else() - project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) - endif() -else() - project(DDNet) +# Extra support for CMake pre-3.0 +if(NOT POLICY CMP0048) set(PROJECT_VERSION_MAJOR ${VERSION_MAJOR}) set(PROJECT_VERSION_MINOR ${VERSION_MINOR}) set(PROJECT_VERSION_PATCH ${VERSION_PATCH}) @@ -48,6 +36,11 @@ else() set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) endif() endif() +if(VERSION_PATCH STREQUAL "0") + project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) +else() + project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +endif() set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) set(ORIGINAL_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) diff --git a/cmake/Download_GTest_CMakeLists.txt.in b/cmake/Download_GTest_CMakeLists.txt.in index 315a3a367..ba373dd7f 100644 --- a/cmake/Download_GTest_CMakeLists.txt.in +++ b/cmake/Download_GTest_CMakeLists.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12...3.19.1) project(googletest-download NONE) From abd2a545220779dc497b9a528024caf47cafa43d Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 8 Dec 2020 10:04:29 +0100 Subject: [PATCH 3/4] Bump to gtest from a commit SHA to 1.10.1 --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a8722567..4f56051f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,8 +538,7 @@ endif() ######################################################################## if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST) - # Change to the 1.9.0 release tag once that works. - set(DDNET_GTEST_VERSION 7b6561c56e353100aca8458d7bc49c4e0119bae8) + set(DDNET_GTEST_VERSION release-1.10.0) # 703bd9caab50b139428cea1aaff9974ebee5742e configure_file(cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . RESULT_VARIABLE result From 037b928dd7fa255fe5200c249f5f0c896cc584ea Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 8 Dec 2020 10:04:59 +0100 Subject: [PATCH 4/4] Manually patch gtest to allow CMake version 2.8.12...3.19.1 Fixes #3355. Works around https://github.com/google/googletest/issues/3040. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f56051f6..9780283e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -556,6 +556,15 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST) message(WARNING "Build step for googletest failed: ${result}") set(DOWNLOAD_GTEST OFF) else() + file(GLOB_RECURSE DDNET_GTEST_CMAKELISTS ${CMAKE_BINARY_DIR}/googletest-src/CMakeLists.txt) + foreach(file ${DDNET_GTEST_CMAKELISTS}) + file(READ ${file} CONTENTS) + string(REPLACE "cmake_minimum_required(VERSION 2.6.4)" "cmake_minimum_required(VERSION 2.8.12...3.19.1)" CONTENTS "${CONTENTS}") + string(REPLACE "cmake_minimum_required(VERSION 2.6.4)" "cmake_minimum_required(VERSION 2.8.12...3.19.1)" CONTENTS "${CONTENTS}") + string(REPLACE "cmake_minimum_required(VERSION 2.8.8)" "cmake_minimum_required(VERSION 2.8.12...3.19.1)" CONTENTS "${CONTENTS}") + file(WRITE ${file} "${CONTENTS}") + endforeach() + # Prevent overriding the parent project's compiler/linker settings on Windows set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)