From 3327050ca66ad34426a82c217c2d60ced61526b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 18 Oct 2020 19:34:23 +0200 Subject: [PATCH] Cocoa: Fix ObjC being built as C with CMake 3.19 CMake 3.19 adds -xc when the LANGUAGE file property is C, breaking our workaround for CMake 3.15 and earlier not understanding the .m suffix. Fixes #1787. --- README.md | 2 ++ src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 43ab7c3c..198063c3 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ information on what to include when reporting a bug. (#1635) - [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays could leak memory + - [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) @@ -322,6 +323,7 @@ skills. - Konstantin Käfer - Eric Larson - Francis Lecavalier + - Jong Won Lee - Robin Leffmann - Glenn Lewis - Shane Liesegang diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 14450938..3a45ea50 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -112,7 +112,7 @@ target_include_directories(glfw PRIVATE target_link_libraries(glfw PRIVATE Threads::Threads ${glfw_LIBRARIES}) # Workaround for CMake not knowing about .m files before version 3.16 -if (APPLE) +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)