diff --git a/CMakeLists.txt b/CMakeLists.txt index 000969d58..9780283e3 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}) @@ -545,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 @@ -564,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) 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) 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); }