From 7d8f3566994d095cdf0bc8b99ba2f10dc60083d4 Mon Sep 17 00:00:00 2001 From: zaveshaa Date: Sat, 22 Aug 2026 11:03:47 +0300 Subject: [PATCH] [cmake] Propagate Cocoa backend frameworks to consumers of static raylib on macOS Bundled GLFW links '-framework Cocoa/IOKit/QuartzCore' privately, and the static-install export block removes glfw from the exported dependencies. As a result the installed CMake package only carried OpenGL.framework, and linking any consumer of libraylib.a failed with undefined Objective-C symbols (_objc_retain etc.). Append the three frameworks to the static install interface when the bundled GLFW is used, so installed consumers get a complete link line. --- src/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bdf3207f3..b68f6066e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,6 +114,19 @@ if (NOT BUILD_SHARED_LIBS) if (NOT glfw3_FOUND) list(REMOVE_ITEM raylib_install_private_libs glfw) + + # Bundled GLFW links its Cocoa backend frameworks privately, so they + # must be propagated to consumers of the static library, whose final + # link line would otherwise miss them. + if (APPLE) + find_library(COCOA_FRAMEWORK Cocoa) + find_library(IOKIT_FRAMEWORK IOKit) + find_library(QUARTZCORE_FRAMEWORK QuartzCore) + list(APPEND raylib_install_private_libs + ${COCOA_FRAMEWORK} + ${IOKIT_FRAMEWORK} + ${QUARTZCORE_FRAMEWORK}) + endif () endif() foreach(lib IN LISTS raylib_install_private_libs)