Manually patch gtest to allow CMake version 2.8.12...3.19.1

Fixes #3355.

Works around https://github.com/google/googletest/issues/3040.
This commit is contained in:
heinrich5991 2020-12-08 10:04:59 +01:00
parent abd2a54522
commit 037b928dd7

View file

@ -556,6 +556,15 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
message(WARNING "Build step for googletest failed: ${result}") message(WARNING "Build step for googletest failed: ${result}")
set(DOWNLOAD_GTEST OFF) set(DOWNLOAD_GTEST OFF)
else() 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 # Prevent overriding the parent project's compiler/linker settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)