From 3301c4775595789957a0e2391985c58aeb52ceb8 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 4 Mar 2022 21:08:56 -0700 Subject: [PATCH] Remove CompileOptionsOverride These overrides existed to prevent MSVC errors related to duplicate compiler warnings. Because we required a version of CMake older 3.15, CMake would add /W3 as a default compiler flag when using MSVC. We then add /W4 in addition to that. Modern CMake versions seem to deduplicate these warnings but older versions did not. The easist fix is to raise the minimum CMake version to 3.15 which changes the default behavior to no longer add /W3 without being explicitly specified. See the below link for more information about this behavior change. https://cmake.org/cmake/help/latest/policy/CMP0092.html --- CMakeLists.txt | 5 +---- cmake/CompilerOptionsOverride.cmake | 5 ----- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 cmake/CompilerOptionsOverride.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7238d1e5..b0191f2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,4 @@ -cmake_minimum_required(VERSION 3.8) - -# customize the compiler options CMake uses to initialize variables with -set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerOptionsOverride.cmake") +cmake_minimum_required(VERSION 3.15) # define a macro that helps defining an option macro(sfml_set_option var default type docstring) diff --git a/cmake/CompilerOptionsOverride.cmake b/cmake/CompilerOptionsOverride.cmake deleted file mode 100644 index d53f7f29..00000000 --- a/cmake/CompilerOptionsOverride.cmake +++ /dev/null @@ -1,5 +0,0 @@ -if(MSVC) - # remove default warning level from CMAKE_CXX_FLAGS_INIT - string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}") - string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT}") -endif()