From 6e1a1792293104e3c751f6ed415fffb37585d515 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 20 Sep 2024 18:31:36 -0700 Subject: [PATCH] Update CMake min to 3.16 - Removes FATAL_ERROR (Ignored by CMake 2.6 and higher) - Removes redundant policy code set by new minimum - Removes 3.15 check to simplify MSVC runtime library code - Removes 3.16 check for objective c files closes #2541 --- CMakeLists.txt | 29 ++--------------------------- src/CMakeLists.txt | 7 ------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 830f8fd9..77094616 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,7 @@ -cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR) +cmake_minimum_required(VERSION 3.16...3.28) project(GLFW VERSION 3.5.0 LANGUAGES C) -if (POLICY CMP0069) - cmake_policy(SET CMP0069 NEW) -endif() - -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - set_property(GLOBAL PROPERTY USE_FOLDERS ON) string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE) @@ -80,24 +72,7 @@ endif() # This is here because it also applies to tests and examples #-------------------------------------------------------------------- if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) - if (CMAKE_VERSION VERSION_LESS 3.15) - foreach (flag CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELWITHDEBINFO) - - if (flag MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") - endif() - if (flag MATCHES "/MDd") - string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") - endif() - - endforeach() - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - endif() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() #-------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 463b898d..d6c18fa5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,13 +137,6 @@ target_include_directories(glfw PRIVATE "${GLFW_BINARY_DIR}/src") target_link_libraries(glfw PRIVATE Threads::Threads) -# Workaround for CMake not knowing about .m files before version 3.16 -if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE) - set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m - cocoa_window.m nsgl_context.m PROPERTIES - LANGUAGE C) -endif() - if (GLFW_BUILD_WIN32) list(APPEND glfw_PKG_LIBS "-lgdi32") endif()