From aa088e42d15994c2a5b4fc219e258bfe5531b03f Mon Sep 17 00:00:00 2001 From: meta-legend <110937181+meta-legend@users.noreply.github.com> Date: Fri, 17 Jul 2026 16:12:57 -0500 Subject: [PATCH] fix static link deps (#5990) --- src/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55428e882..bdf3207f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,6 +107,20 @@ endif () target_link_libraries(raylib PRIVATE $) target_link_libraries(raylib PUBLIC ${LIBS_PUBLIC}) +# Static libraries must export their private link dependencies for installed consumers. +# LINK_ONLY keeps those dependencies out of the compile interface. +if (NOT BUILD_SHARED_LIBS) + set(raylib_install_private_libs ${LIBS_PRIVATE}) + + if (NOT glfw3_FOUND) + list(REMOVE_ITEM raylib_install_private_libs glfw) + endif() + + foreach(lib IN LISTS raylib_install_private_libs) + target_link_libraries(raylib INTERFACE $>) + endforeach() +endif() + # Sets some compile time definitions for the pre-processor # If CUSTOMIZE_BUILD option is on you will not use config.h by default # and you will be able to select more build options