[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.
This commit is contained in:
zaveshaa 2026-08-22 11:03:47 +03:00
commit 7d8f356699

View file

@ -114,6 +114,19 @@ if (NOT BUILD_SHARED_LIBS)
if (NOT glfw3_FOUND) if (NOT glfw3_FOUND)
list(REMOVE_ITEM raylib_install_private_libs glfw) 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() endif()
foreach(lib IN LISTS raylib_install_private_libs) foreach(lib IN LISTS raylib_install_private_libs)