mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #3387
3387: Fix CMake deprecation warning for old CMake versions r=def- a=heinrich5991 Fixes #3355 Works around https://github.com/google/googletest/issues/3040. ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
56a90c25ec
|
@ -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 "")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9 CACHE INTERNAL "")
|
||||||
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.9)
|
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")
|
message(FATAL_ERROR "Couldn't parse version from src/game/version.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(POLICY CMP0017)
|
# Extra support for CMake pre-3.0
|
||||||
cmake_policy(SET CMP0017 NEW)
|
if(NOT POLICY CMP0048)
|
||||||
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)
|
|
||||||
set(PROJECT_VERSION_MAJOR ${VERSION_MAJOR})
|
set(PROJECT_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
set(PROJECT_VERSION_MINOR ${VERSION_MINOR})
|
set(PROJECT_VERSION_MINOR ${VERSION_MINOR})
|
||||||
set(PROJECT_VERSION_PATCH ${VERSION_PATCH})
|
set(PROJECT_VERSION_PATCH ${VERSION_PATCH})
|
||||||
|
@ -48,6 +36,11 @@ else()
|
||||||
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||||
endif()
|
endif()
|
||||||
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_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||||
set(ORIGINAL_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
set(ORIGINAL_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
||||||
|
@ -545,8 +538,7 @@ endif()
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
# Change to the 1.9.0 release tag once that works.
|
set(DDNET_GTEST_VERSION release-1.10.0) # 703bd9caab50b139428cea1aaff9974ebee5742e
|
||||||
set(DDNET_GTEST_VERSION 7b6561c56e353100aca8458d7bc49c4e0119bae8)
|
|
||||||
configure_file(cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
configure_file(cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
|
@ -564,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)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8.12...3.19.1)
|
||||||
|
|
||||||
project(googletest-download NONE)
|
project(googletest-download NONE)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,4 @@ TEST(BlocklistDriver, Invalid)
|
||||||
int Major, Minor, Patch;
|
int Major, Minor, Patch;
|
||||||
EXPECT_STREQ(ParseBlocklistDriverVersions("Intel", "Build 25.20.100.7810", Major, Minor, Patch), NULL);
|
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.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);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue