diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bdf3207f3..25b61734d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,6 +114,20 @@ 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. Only the Desktop platform uses + # bundled GLFW; other platforms (e.g. Memory) have no Cocoa/GLFW symbols. + if (APPLE AND PLATFORM STREQUAL "Desktop") + 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)